Skip to content

Add support for Gemini

Latest
Compare
Choose a tag to compare
@benjreinhart benjreinhart released this 21 Dec 00:31
· 3 commits to main since this release
ce5804a
import { StreamToIterable } from '@axflow/models/shared';
import { GoogleGenerateContent } from '@axflow/models/google/generate-content';

const stream = await GoogleGenerateContent.stream(
  {
    model: 'gemini-pro',
    contents: [
      {
        parts: [
          {
            text: 'Write a two sentence story about a magic backpack',
          },
        ],
      },
    ],
  },
  {
    apiKey: process.env.GOOGLE_API_KEY,
  }
);

for await (const chunk of StreamToIterable(stream)) {
  console.log(chunk);
}