feat(model): 双协议 LLM Provider(AnthropicChNativeAdapter /v1/messages + tool_use.input→Args 直接映射 + 流式重组)+ Provider 感知工厂/路由 + LLM_PROVIDER/anthropic 配置(OpenAI 兼容保留)
This commit is contained in:
1 parent
f9650185f1
commit
3632e04733
11 files changed
+1452
-18
No files matched your search
@@ -29,16 +29,10 @@ func NewChain(steps ...Step) *Chain {
|
||||
// NewOpenAIChatChain builds a fallback chain from a single supplier config: the
|
||||
// primary model first, then cfg.Fallback (when set and distinct), both served
|
||||
// by an OpenAIChatAdapter against the same OpenAI-compatible endpoint. It
|
||||
// returns ErrNoModel when no base URL or primary model is configured.
|
||||
// delegates to the provider-aware builder so the OpenAI path and the factory stay
|
||||
// in sync. It returns ErrNoModel when no base URL or primary model is configured.
|
||||
func NewOpenAIChatChain(cfg config.LLMConfig, opts ...OpenAIOption) (*Chain, error) {
|
||||
if cfg.BaseURL == "" || cfg.Model == "" {
|
||||
return nil, ErrNoModel
|
||||
}
|
||||
steps := []Step{{Model: cfg.Model, Adapter: NewOpenAIChat(cfg, opts...)}}
|
||||
if cfg.Fallback != "" && cfg.Fallback != cfg.Model {
|
||||
steps = append(steps, Step{Model: cfg.Fallback, Adapter: NewOpenAIChat(cfg, opts...)})
|
||||
}
|
||||
return NewChain(steps...), nil
|
||||
return newOpenAIChain(cfg, opts...)
|
||||
}
|
||||
|
||||
// Name returns the chain identifier.
|
||||
|
||||
Reference in new issue
Block a user