test(ai): simplify TestLLM setup
This commit is contained in:
parent
8ce850e142
commit
dc819e04cc
5 changed files with 32 additions and 9 deletions
|
|
@ -53,7 +53,7 @@ const textEvents = (value: string, id: string) => [
|
|||
LLMEvent.textEnd({ id }),
|
||||
]
|
||||
|
||||
export const text = (value: string, id: string) => stop(...textEvents(value, id))
|
||||
export const text = (value: string, id = "text-0") => stop(...textEvents(value, id))
|
||||
|
||||
export const textWithUsage = (value: string, id: string, inputTokens: number) =>
|
||||
complete(
|
||||
|
|
@ -147,6 +147,10 @@ export const clientLayer = Layer.effect(
|
|||
Effect.map(Service, (service) => service.client),
|
||||
)
|
||||
|
||||
export const layerWithClient = (options: LayerOptions = {}) => clientLayer.pipe(Layer.provideMerge(layer(options)))
|
||||
|
||||
export const requests = Service.use((service) => Effect.succeed(service.requests))
|
||||
|
||||
export const push = (...responses: readonly Response[]) => Service.use((service) => service.push(...responses))
|
||||
|
||||
export const always = (response: Response) => Service.use((service) => service.always(response))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue