GetBackendByAPIType returns the appropriate UseChatBackend implementation for the given API type
(apiType string)
| 63 | |
| 64 | // GetBackendByAPIType returns the appropriate UseChatBackend implementation for the given API type |
| 65 | func 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 |
| 81 | type openaiResponsesBackend struct{} |
no outgoing calls
no test coverage detected