Issue when talking with AI assistant

hi, I have set up the Google API key to use gemini flash as model to power the AI assistant, sometimes you can chat with it, but randomly this error happens and shows a portion of it in the chat as response, directus self hosted, v11.15.4

APICallError [AI_APICallError]: * GenerateContentRequest.tools[0].function_declarations[11].parameters.properties[appearance].enum: only allowed for STRING type
    at file:///directus/node_modules/.pnpm/@ai-sdk+provider-utils@4.0.4_zod@4.1.12/node_modules/@ai-sdk/provider-utils/dist/index.mjs:2347:14
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async postToApi (file:///directus/node_modules/.pnpm/@ai-sdk+provider-utils@4.0.4_zod@4.1.12/node_modules/@ai-sdk/provider-utils/dist/index.mjs:2190:28)
    at async GoogleGenerativeAILanguageModel.doStream (file:///directus/node_modules/.pnpm/@ai-sdk+google@3.0.6_zod@4.1.12/node_modules/@ai-sdk/google/dist/index.mjs:1141:50)
    at async fn (file:///directus/node_modules/.pnpm/ai@6.0.25_zod@4.1.12/node_modules/ai/dist/index.mjs:6415:25)
    at async file:///directus/node_modules/.pnpm/ai@6.0.25_zod@4.1.12/node_modules/ai/dist/index.mjs:1974:24
    at async _retryWithExponentialBackoff (file:///directus/node_modules/.pnpm/ai@6.0.25_zod@4.1.12/node_modules/ai/dist/index.mjs:2233:12)
    at async streamStep (file:///directus/node_modules/.pnpm/ai@6.0.25_zod@4.1.12/node_modules/ai/dist/index.mjs:6372:15)
    at async fn (file:///directus/node_modules/.pnpm/ai@6.0.25_zod@4.1.12/node_modules/ai/dist/index.mjs:6741:9)
    at async file:///directus/node_modules/.pnpm/ai@6.0.25_zod@4.1.12/node_modules/ai/dist/index.mjs:1974:24 {
  cause: undefined,
  url: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:streamGenerateContent?alt=sse',

1 Answer

1

Hey @franjorub!

This looks like a bug on our end. The AI tool schemas we send to the model include enum constraints on non-string type properties, which OpenAI accepts but Gemini’s API is stricter about and rejects.

I’ve opened an issue for this → AI assistant tool schemas incompatible with Gemini · Issue #26762 · directus/directus · GitHub :slight_smile: the schemas need to be provider-agnostic so they work across all supported models.

thank you ! I would like to follow this bug because maybe this is something you will face by other users context: since Google AI Pro is giving $10 credits for GCP / Gemini API, I used them to deploy a self host setup of Directus, plus the addition of AI Assistant ! this is important because, writer end users can ask to the assistant to do certain actions without the need of visiting technical documentation.

Absolutely! Thanks again for letting me know :)