(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestPassthroughRoutesForProviders(t *testing.T) { |
| 122 | t.Parallel() |
| 123 | |
| 124 | upstreamRespBody := "upstream response" |
| 125 | tests := []struct { |
| 126 | name string |
| 127 | baseURLPath string |
| 128 | requestPath string |
| 129 | provider func(string) provider.Provider |
| 130 | expectPath string |
| 131 | }{ |
| 132 | { |
| 133 | name: "openAI_no_base_path", |
| 134 | requestPath: "/openai/v1/conversations", |
| 135 | provider: func(baseURL string) provider.Provider { |
| 136 | return aibridge.NewOpenAIProvider(config.OpenAI{BaseURL: baseURL}) |
| 137 | }, |
| 138 | expectPath: "/conversations", |
| 139 | }, |
| 140 | { |
| 141 | name: "openAI_with_base_path", |
| 142 | baseURLPath: "/v1", |
| 143 | requestPath: "/openai/v1/conversations", |
| 144 | provider: func(baseURL string) provider.Provider { |
| 145 | return aibridge.NewOpenAIProvider(config.OpenAI{BaseURL: baseURL}) |
| 146 | }, |
| 147 | expectPath: "/v1/conversations", |
| 148 | }, |
| 149 | { |
| 150 | name: "anthropic_no_base_path", |
| 151 | requestPath: "/anthropic/v1/models", |
| 152 | provider: func(baseURL string) provider.Provider { |
| 153 | return aibridge.NewAnthropicProvider(config.Anthropic{BaseURL: baseURL}, nil) |
| 154 | }, |
| 155 | expectPath: "/v1/models", |
| 156 | }, |
| 157 | { |
| 158 | name: "anthropic_with_base_path", |
| 159 | baseURLPath: "/v1", |
| 160 | requestPath: "/anthropic/v1/models", |
| 161 | provider: func(baseURL string) provider.Provider { |
| 162 | return aibridge.NewAnthropicProvider(config.Anthropic{BaseURL: baseURL}, nil) |
| 163 | }, |
| 164 | expectPath: "/v1/v1/models", |
| 165 | }, |
| 166 | { |
| 167 | name: "copilot_no_base_path", |
| 168 | requestPath: "/copilot/models", |
| 169 | provider: func(baseURL string) provider.Provider { |
| 170 | return aibridge.NewCopilotProvider(config.Copilot{BaseURL: baseURL}) |
| 171 | }, |
| 172 | expectPath: "/models", |
| 173 | }, |
| 174 | { |
| 175 | name: "copilot_with_base_path", |
| 176 | baseURLPath: "/v1", |
| 177 | requestPath: "/copilot/models", |
| 178 | provider: func(baseURL string) provider.Provider { |
nothing calls this directly
no test coverage detected