Describe the bug
The input schema parsing for Cohere currently errors out. It's expecting Zod types, but we have a Record<string, any> instead.
I also suspect there will be problems supporting more complex object types properly with the current implementation. This is somewhat against what Cohere recommends (which is a flat structure), although there is some support for Dict, List and python data objects. If we're not able to support deeply nested objects, there should be an error that properly reflects that.
Error: Unsupported Zod type: String
at zodTypeToPythonType (/Users/michaeldoyle/repos/thirdparty/genkit-experiments/apps/model-garden/node_modules/.pnpm/genkitx-cohere@0.9.0_@aws-sdk+client-sso-oidc@3.588.0_@genkit-ai+ai@0.5.2_@genkit-ai+core@0.5.2/node_modules/genkitx-cohere/lib/command.js:203:11)
at toCohereTool (/Users/michaeldoyle/repos/thirdparty/genkit-experiments/apps/model-garden/node_modules/.pnpm/genkitx-cohere@0.9.0_@aws-sdk+client-sso-oidc@3.588.0_@genkit-ai+ai@0.5.2_@genkit-ai+core@0.5.2/node_modules/genkitx-cohere/lib/command.js:210:13)
at Array.map (<anonymous>)
at toCohereRequestBody (/Users/michaeldoyle/repos/thirdparty/genkit-experiments/apps/model-garden/node_modules/.pnpm/genkitx-cohere@0.9.0_@aws-sdk+client-sso-oidc@3.588.0_@genkit-ai+ai@0.5.2_@genkit-ai+core@0.5.2/node_modules/genkitx-cohere/lib/command.js:425:55)
at /Users/michaeldoyle/repos/thirdparty/genkit-experiments/apps/model-garden/node_modules/.pnpm/genkitx-cohere@0.9.0_@aws-sdk+client-sso-oidc@3.588.0_@genkit-ai+ai@0.5.2_@genkit-ai+core@0.5.2/node_modules/genkitx-cohere/lib/command.js:447:20
To Reproduce
Example Tools Schema
defineTool(
{
name: 'getStockPrice',
description: 'Get the price for the given stock ticker.',
inputSchema: z.object({ symbol: z.string() }),
outputSchema: z.any(),
},
async (input) => {
// ...
}
);
Affected plugin(s)
Cohere
Describe the bug The input schema parsing for Cohere currently errors out. It's expecting Zod types, but we have a
Record<string, any>
instead.I also suspect there will be problems supporting more complex object types properly with the current implementation. This is somewhat against what Cohere recommends (which is a flat structure), although there is some support for
Dict
,List
and python data objects. If we're not able to support deeply nested objects, there should be an error that properly reflects that.To Reproduce
Example Tools Schema
Expected behavior Properly parse the schema. :)
Plugin(s) version: 0.9.0
Genkit version: 0.5.2