(result: unknown)
| 16 | }) |
| 17 | |
| 18 | const encodeToolResult = (result: unknown) => |
| 19 | Effect.gen(function*() { |
| 20 | const captured: Array<typeof Generated.GenerateContentRequest.Encoded> = [] |
| 21 | yield* LanguageModel.generateText({ |
| 22 | prompt: [{ |
| 23 | role: "tool", |
| 24 | content: [{ |
| 25 | type: "tool-result", |
| 26 | id: "call_1", |
| 27 | name: "tool", |
| 28 | isFailure: false, |
| 29 | providerExecuted: false, |
| 30 | result |
| 31 | }] |
| 32 | }] |
| 33 | }).pipe( |
| 34 | Effect.provide(GoogleLanguageModel.layer({ model: "gemini-2.5-flash" })), |
| 35 | Effect.provide(Layer.succeed(GoogleClient, { |
| 36 | client: null as any, |
| 37 | streamRequest: null as any, |
| 38 | generateContent: (request) => |
| 39 | Effect.sync(() => { |
| 40 | captured.push(request) |
| 41 | return textResponse |
| 42 | }), |
| 43 | generateContentStream: null as any |
| 44 | })) |
| 45 | ) |
| 46 | return captured[0].contents[0].parts![0].functionResponse!.response |
| 47 | }) |
| 48 | |
| 49 | describe("GoogleLanguageModel", () => { |
| 50 | it.effect("wraps non-object tool results in an object", () => |
no test coverage detected