Skip to content

Commit 01788c6

Browse files
authored
@inngest/ai: Gemini adapter + Grok OpenAI-compatible support (#884)
- **Gemini**: does not support tool calling via their OpenAI compatible API -> full adapter - **Grok**: OpenAI compatible API but does not support strict parameters with function calls -> partial adapter on top of openai
1 parent 5f18119 commit 01788c6

File tree

10 files changed

+614
-19
lines changed

10 files changed

+614
-19
lines changed

.changeset/new-ghosts-train.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@inngest/ai": patch
3+
---
4+
5+
`@inngest/ai`: Gemini adapter + Grok OpenAI-compatible support

packages/ai/src/adapter.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
/* eslint-disable @typescript-eslint/no-namespace */
12
import { type AnthropicAiAdapter } from "./adapters/anthropic.js";
3+
import { type GeminiAiAdapter } from "./adapters/gemini.js";
4+
import { type GrokAiAdapter } from "./adapters/grok.js";
25
import { type OpenAiAiAdapter } from "./adapters/openai.js";
36

47
/**
@@ -102,7 +105,7 @@ export namespace AiAdapter {
102105
/**
103106
* Supported I/O formats for AI models.
104107
*/
105-
export type Format = "openai-chat" | "anthropic";
108+
export type Format = "openai-chat" | "anthropic" | "gemini" | "grok";
106109

107110
/**
108111
* A function that creates a model that adheres to an existng AI adapter
@@ -120,6 +123,8 @@ export namespace AiAdapter {
120123
const adapters = {
121124
"openai-chat": null as unknown as OpenAiAiAdapter,
122125
anthropic: null as unknown as AnthropicAiAdapter,
126+
gemini: null as unknown as GeminiAiAdapter,
127+
grok: null as unknown as GrokAiAdapter,
123128
} satisfies Record<AiAdapter.Format, AiAdapter>;
124129

125130
/**

0 commit comments

Comments
 (0)