mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
refactor: unify SDK model factories into internal/models
Move CreateModel, BuildReasoningOptions, ReasoningBudgetTokens and related types from internal/agent to internal/models as NewSDKChatModel, SDKModelConfig, etc. This eliminates duplicate ClientType constants and centralises all Twilight AI SDK instance creation in a single package. NewSDKEmbeddingModel now accepts a clientType parameter and dispatches to the native Google embedding provider for google-generative-ai, instead of always using the OpenAI-compatible endpoint.
This commit is contained in:
@@ -270,15 +270,15 @@ func (r *Resolver) resolve(ctx context.Context, req conversation.ChatRequest) (r
|
||||
reasoningEffort = botSettings.ReasoningEffort
|
||||
}
|
||||
|
||||
var reasoningConfig *agentpkg.ReasoningConfig
|
||||
var reasoningConfig *models.ReasoningConfig
|
||||
if reasoningEffort != "" {
|
||||
reasoningConfig = &agentpkg.ReasoningConfig{
|
||||
reasoningConfig = &models.ReasoningConfig{
|
||||
Enabled: true,
|
||||
Effort: reasoningEffort,
|
||||
}
|
||||
}
|
||||
|
||||
modelCfg := agentpkg.ModelConfig{
|
||||
modelCfg := models.SDKModelConfig{
|
||||
ModelID: chatModel.ModelID,
|
||||
ClientType: clientType,
|
||||
APIKey: provider.ApiKey,
|
||||
@@ -286,7 +286,7 @@ func (r *Resolver) resolve(ctx context.Context, req conversation.ChatRequest) (r
|
||||
ReasoningConfig: reasoningConfig,
|
||||
}
|
||||
|
||||
sdkModel := agentpkg.CreateModel(modelCfg)
|
||||
sdkModel := models.NewSDKChatModel(modelCfg)
|
||||
sdkMessages := modelMessagesToSDKMessages(nonNilModelMessages(messages))
|
||||
|
||||
runCfg := agentpkg.RunConfig{
|
||||
|
||||
Reference in New Issue
Block a user