mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-19 23:01:32 +00:00
feat(ai): Add new streaming generate API with AsyncIterable interface
- Implement QueuedGenerateStream class that extends AsyncIterable with finalMessage() method - Add new types: GenerateStream, GenerateOptions, GenerateOptionsUnified, GenerateFunction - Create generateAnthropic function-based implementation replacing class-based approach - Add comprehensive test suite for the new generate API - Support streaming events with text, thinking, and tool call deltas - Map ReasoningEffort to provider-specific options - Include apiKey in options instead of constructor parameter
This commit is contained in:
parent
be07c08a75
commit
004de3c9d0
6 changed files with 1106 additions and 129 deletions
|
|
@ -3,26 +3,26 @@
|
|||
|
||||
export const version = "0.5.8";
|
||||
|
||||
// Export generate API
|
||||
export {
|
||||
generate,
|
||||
generateComplete,
|
||||
getApiKey,
|
||||
QueuedGenerateStream,
|
||||
registerApi,
|
||||
setApiKey,
|
||||
} from "./generate.js";
|
||||
// Export generated models data
|
||||
export { PROVIDERS } from "./models.generated.js";
|
||||
|
||||
// Export models utilities and types
|
||||
// Export model utilities
|
||||
export {
|
||||
type AnthropicModel,
|
||||
type CerebrasModel,
|
||||
createLLM,
|
||||
type GoogleModel,
|
||||
type GroqModel,
|
||||
type Model,
|
||||
type OpenAIModel,
|
||||
type OpenRouterModel,
|
||||
PROVIDER_CONFIG,
|
||||
type ProviderModels,
|
||||
type ProviderToLLM,
|
||||
type XAIModel,
|
||||
calculateCost,
|
||||
getModel,
|
||||
type KnownProvider,
|
||||
registerModel,
|
||||
} from "./models.js";
|
||||
|
||||
// Export providers
|
||||
// Legacy providers (to be deprecated)
|
||||
export { AnthropicLLM } from "./providers/anthropic.js";
|
||||
export { GoogleLLM } from "./providers/google.js";
|
||||
export { OpenAICompletionsLLM } from "./providers/openai-completions.js";
|
||||
|
|
@ -30,3 +30,8 @@ export { OpenAIResponsesLLM } from "./providers/openai-responses.js";
|
|||
|
||||
// Export types
|
||||
export type * from "./types.js";
|
||||
|
||||
// TODO: Remove these legacy exports once consumers are updated
|
||||
export function createLLM(): never {
|
||||
throw new Error("createLLM is deprecated. Use generate() with getModel() instead.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue