Skip to content

Gemini integration issue with createAIExtension #1792

Open
@alancmclean

Description

@alancmclean

Describe the bug
I'm unable to integrate Gemini into a custom extension. I'm following the example and it seems to fail with the following error:
Error calling LLM TypeError: Cannot read properties of undefined (reading 'getStreamTools')

Here is the code I'm using:

const google = createGoogleGenerativeAI({
  apiKey: API_KEY
});
const model = google('gemini-2.0-flash');


export default function App() {
  const editor = useCreateBlockNote({
    
    dictionary: {
      ...en,
      ai: aiEn, // add default translations for the AI extension
    },
    extensions: [
      createAIExtension({
        model,
        dataFormat: llmFormats.markdown,
        promptBuilder: async (prompt, context) => {
          return `${PREAMBLE} ${prompt}\n\nContext: ${context}`;
        },
      })
    ]
  });

Any thoughts on what's up here? FWIW, I've used Gemini in a different component that was working fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions