MCPcopy
hub / github.com/wavetermdev/waveterm / GetBackendByAPIType

Function GetBackendByAPIType

pkg/aiusechat/usechat-backend.go:65–78  ·  view source on GitHub ↗

GetBackendByAPIType returns the appropriate UseChatBackend implementation for the given API type

(apiType string)

Source from the content-addressed store, hash-verified

63
64// GetBackendByAPIType returns the appropriate UseChatBackend implementation for the given API type
65func GetBackendByAPIType(apiType string) (UseChatBackend, error) {
66 switch apiType {
67 case uctypes.APIType_OpenAIResponses:
68 return &openaiResponsesBackend{}, nil
69 case uctypes.APIType_OpenAIChat:
70 return &openaiCompletionsBackend{}, nil
71 case uctypes.APIType_AnthropicMessages:
72 return &anthropicBackend{}, nil
73 case uctypes.APIType_GoogleGemini:
74 return &geminiBackend{}, nil
75 default:
76 return nil, fmt.Errorf("unsupported API type: %s", apiType)
77 }
78}
79
80// openaiResponsesBackend implements UseChatBackend for OpenAI API
81type openaiResponsesBackend struct{}

Callers 3

ConvertAIChatToUIChatFunction · 0.85
WaveAIPostMessageWrapFunction · 0.85
CreateWriteTextFileDiffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected