Azure openai list models (#290)
* feat(models): include flow for azure openai endpoint * feat(models): include flow for azure openai endpoint * feat(models): include flow for azure openai endpoint * chore(fullURL): update logic to run in fullURL function * chore(fullURL): update based on pr comments to use c.config.APIVersion
This commit is contained in:
@@ -103,6 +103,11 @@ func (c *Client) fullURL(suffix string) string {
|
||||
if c.config.APIType == APITypeAzure || c.config.APIType == APITypeAzureAD {
|
||||
baseURL := c.config.BaseURL
|
||||
baseURL = strings.TrimRight(baseURL, "/")
|
||||
// if suffix is /models change to {endpoint}/openai/models?api-version=2022-12-01
|
||||
// https://learn.microsoft.com/en-us/rest/api/cognitiveservices/azureopenaistable/models/list?tabs=HTTP
|
||||
if strings.Contains(suffix, "/models") {
|
||||
return fmt.Sprintf("%s/%s%s?api-version=%s", baseURL, azureAPIPrefix, suffix, c.config.APIVersion)
|
||||
}
|
||||
return fmt.Sprintf("%s/%s/%s/%s%s?api-version=%s",
|
||||
baseURL, azureAPIPrefix, azureDeploymentsPrefix, c.config.Engine, suffix, c.config.APIVersion)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user