(client tls_client.HttpClient, api_key string, organization string, proxy string)
| 118 | return response, nil |
| 119 | } |
| 120 | func GetModels(client tls_client.HttpClient, api_key string, organization string, proxy string) (*http.Response, error) { |
| 121 | header := baseHeader() |
| 122 | header.Set("authorization", "Bearer "+api_key) |
| 123 | header.Set("groq-app", "chat") |
| 124 | header.Set("groq-organization", organization) |
| 125 | if proxy != "" { |
| 126 | client.SetProxy(proxy) |
| 127 | } |
| 128 | req, err := http.NewRequest(http.MethodGet, "https://api.groq.com/openai/v1/models", nil) |
| 129 | //response, err := client.Request("GET", "https://api.groq.com/openai/v1/models", header, nil, nil) |
| 130 | req.Header = header |
| 131 | if err != nil { |
| 132 | return nil, err |
| 133 | } |
| 134 | response, err := client.Do(req) |
| 135 | if err != nil { |
| 136 | return nil, err |
| 137 | } |
| 138 | if response.StatusCode != 200 { |
| 139 | return nil, errors.New("response status code is not 200") |
| 140 | } |
| 141 | return response, nil |
| 142 | } |
nothing calls this directly
no test coverage detected