Skip to content

Commit

Permalink
docs[patch]: Add note on genai docs for invalid tool schema (#6116)
Browse files Browse the repository at this point in the history
* docs[patch]: Add note on genai docs for invalid tool schema

* callout nits
  • Loading branch information
bracesproul authored Jul 17, 2024
1 parent eccc7d1 commit f416316
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/core_docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,26 @@ docs/how_to/trim_messages.md
docs/how_to/trim_messages.mdx
docs/how_to/tools_prompting.md
docs/how_to/tools_prompting.mdx
docs/how_to/tools_error.md
docs/how_to/tools_error.mdx
docs/how_to/tools_builtin.md
docs/how_to/tools_builtin.mdx
docs/how_to/tool_streaming.md
docs/how_to/tool_streaming.mdx
docs/how_to/tool_stream_events.md
docs/how_to/tool_stream_events.mdx
docs/how_to/tool_runtime.md
docs/how_to/tool_runtime.mdx
docs/how_to/tool_results_pass_to_model.md
docs/how_to/tool_results_pass_to_model.mdx
docs/how_to/tool_configure.md
docs/how_to/tool_configure.mdx
docs/how_to/tool_calls_multimodal.md
docs/how_to/tool_calls_multimodal.mdx
docs/how_to/tool_calling.md
docs/how_to/tool_calling.mdx
docs/how_to/tool_artifacts.md
docs/how_to/tool_artifacts.mdx
docs/how_to/structured_output.md
docs/how_to/structured_output.mdx
docs/how_to/streaming.md
Expand Down
22 changes: 22 additions & 0 deletions docs/core_docs/docs/integrations/chat/google_generativeai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ import GoogleGenerativeAI from "@examples/models/chat/googlegenerativeai.ts";

## Tool calling

:::caution
The Google GenerativeAI package as of version `0.0.23` does not allow tool schemas to contain an object with unknown properties.
The Google VertexAI package (as of version `0.0.20`) does support this pattern.
[Click here for the Google VertexAI package documentation](/docs/integrations/chat/google_vertex_ai).

For example, the following Zod schema will throw an error:

```typescript
const schema = z.object({
properties: z.record(z.unknown()), // Not allowed
});
```

or

```typescript
const schema = z.record(z.unknown()); // Not allowed
```

Instead, you should explicitly define the properties of the object field, or use the Google VertexAI package.
:::

import GoogleGenerativeAIToolCalling from "@examples/models/chat/googlegenerativeai_tools.ts";

<CodeBlock language="typescript">{GoogleGenerativeAIToolCalling}</CodeBlock>
Expand Down

0 comments on commit f416316

Please sign in to comment.