Skip to content

Commit 25d8288

Browse files
committed
feat: upgrade plugin to v2 and add custom models
1 parent f988667 commit 25d8288

9 files changed

Lines changed: 7554 additions & 2530 deletions

File tree

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,39 @@ console.log(result.then((res) => res.text));
140140

141141
For more detailed examples and the explanation of other functionalities, refer to the [official Genkit documentation](https://firebase.google.com/docs/genkit/get-started).
142142

143+
## Using Custom Models
144+
145+
If you want to use a model that is not exported by this plugin, you can register it using the `customModels` option when initializing the plugin:
146+
147+
```typescript
148+
import { genkit, z } from 'genkit';
149+
import { github } from 'genkitx-github';
150+
151+
const ai = genkit({
152+
plugins: [
153+
github({
154+
customModels: ['gpt-5', 'my-custom-model'], // Register custom models
155+
}),
156+
],
157+
});
158+
159+
// Use the custom model by specifying its name as a string
160+
export const customModelFlow = ai.defineFlow(
161+
{
162+
name: 'customModelFlow',
163+
inputSchema: z.string(),
164+
outputSchema: z.string(),
165+
},
166+
async (subject) => {
167+
const llmResponse = await ai.generate({
168+
model: 'github/gpt-5', // Use any registered custom model
169+
prompt: `Tell me about ${subject}`,
170+
});
171+
return llmResponse.text;
172+
}
173+
);
174+
```
175+
143176
## Supported models
144177

145178
This plugin supports all currently available **Chat/Completion** and **Embeddings** models from GitHub Models. This plugin supports image input and multimodal models.

0 commit comments

Comments
 (0)