(provider string, runEmbeddings bool, resourceName string, params map[string]string)
| 649 | } |
| 650 | |
| 651 | func buildRequestUrl(provider string, runEmbeddings bool, resourceName string, params map[string]string) string { |
| 652 | if provider == "openai" && runEmbeddings { |
| 653 | return "https://api.openai.com/v1/embeddings" |
| 654 | } |
| 655 | |
| 656 | if provider == "openai" && !runEmbeddings { |
| 657 | return "https://api.openai.com/v1/chat/completions" |
| 658 | } |
| 659 | |
| 660 | deploymentId := params["deploymentId"] |
| 661 | apiVersion := params["apiVersion"] |
| 662 | |
| 663 | if provider == "azure" && runEmbeddings { |
| 664 | return fmt.Sprintf("https://%s.openai.azure.com/openai/deployments/%s/embeddings?api-version=%s", resourceName, deploymentId, apiVersion) |
| 665 | } |
| 666 | |
| 667 | if provider == "azure" && !runEmbeddings { |
| 668 | return fmt.Sprintf("https://%s.openai.azure.com/openai/deployments/%s/chat/completions?api-version=%s", resourceName, deploymentId, apiVersion) |
| 669 | } |
| 670 | |
| 671 | return "" |
| 672 | } |
| 673 | |
| 674 | func setHttpRequestAuthHeader(provider string, req *http.Request, key string) { |
| 675 | if provider == "azure" { |
no outgoing calls
no test coverage detected