mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 03:03:44 +00:00
refactor(ai): Implement unified model system with type-safe createLLM
- Add Model interface to types.ts with normalized structure - Create type-safe generic createLLM function with provider-specific model constraints - Generate models from OpenRouter API and models.dev data - Strip provider prefixes for direct providers (google, openai, anthropic, xai) - Keep full model IDs for OpenRouter-proxied models - Clean separation: types.ts (Model interface), models.ts (factory logic), models.generated.ts (data) - Remove old model scripts and unused dependencies - Rename GeminiLLM to GoogleLLM for consistency - Add tests for new providers (xAI, Groq, Cerebras, OpenRouter) - Support 181 tool-capable models across 7 providers with full type safety
This commit is contained in:
parent
3f36051bc6
commit
c7618db3f7
8 changed files with 409 additions and 418 deletions
|
|
@ -17,7 +17,7 @@ import type {
|
|||
ToolCall,
|
||||
} from "../types.js";
|
||||
|
||||
export interface GeminiLLMOptions extends LLMOptions {
|
||||
export interface GoogleLLMOptions extends LLMOptions {
|
||||
toolChoice?: "auto" | "none" | "any";
|
||||
thinking?: {
|
||||
enabled: boolean;
|
||||
|
|
@ -25,7 +25,7 @@ export interface GeminiLLMOptions extends LLMOptions {
|
|||
};
|
||||
}
|
||||
|
||||
export class GeminiLLM implements LLM<GeminiLLMOptions> {
|
||||
export class GoogleLLM implements LLM<GoogleLLMOptions> {
|
||||
private client: GoogleGenAI;
|
||||
private model: string;
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ export class GeminiLLM implements LLM<GeminiLLMOptions> {
|
|||
this.model = model;
|
||||
}
|
||||
|
||||
async complete(context: Context, options?: GeminiLLMOptions): Promise<AssistantMessage> {
|
||||
async complete(context: Context, options?: GoogleLLMOptions): Promise<AssistantMessage> {
|
||||
try {
|
||||
const contents = this.convertMessages(context.messages);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue