Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure openai assistans list interface parameter splicing error #794

Closed
WhiteNightMo opened this issue Jul 18, 2024 · 6 comments · Fixed by #797
Closed

Azure openai assistans list interface parameter splicing error #794

WhiteNightMo opened this issue Jul 18, 2024 · 6 comments · Fixed by #797
Labels
bug Something isn't working

Comments

@WhiteNightMo
Copy link

Environment:

  • go-openai version: v1.24.0
  • Go version: 1.19.10

Screenshots/Logs
image

Additional context
If the parameter contains paging information, the generated url will contain two question marks.
The output I printed:

c.fullURL(urlSuffix): https://xxx.openai.azure.com/openai/assistants?limit=10?api-version=2023-05-15
@WhiteNightMo WhiteNightMo added the bug Something isn't working label Jul 18, 2024
eiixy added a commit to eiixy/go-openai that referenced this issue Jul 19, 2024
@WhiteNightMo
Copy link
Author

But the baseURL comes from the config file, and it's really the suffix that should be of concern.

baseURL := c.config.BaseURL
baseURL = strings.TrimRight(baseURL, "/")
parseURL, _ := url.Parse(baseURL)

Here's what I printed and it didn't change anything.
image

@WhiteNightMo
Copy link
Author

@eiixy @sashabaranov

eiixy added a commit to eiixy/go-openai that referenced this issue Aug 7, 2024
@eiixy
Copy link
Contributor

eiixy commented Aug 8, 2024

@WhiteNightMo Could you please check if the unit tests cover your use case? #817

@WhiteNightMo
Copy link
Author

@WhiteNightMo Could you please check if the unit tests cover your use case? #817

Thanks for the fix. For me, the /audio/speech interface was missing from the judgment here. I'm not sure if there are other interfaces missing here.

if !containsSubstr([]string{
	"/completions",
	"/embeddings",
	"/chat/completions",
	"/audio/transcriptions",
	"/audio/translations",
	"/images/generations",
}, parseSuffix.Path) {
	return fmt.Sprintf("%s/%s%s?%s", baseURL, azureAPIPrefix, parseSuffix.Path, query.Encode())
}

@eiixy
Copy link
Contributor

eiixy commented Aug 8, 2024

@WhiteNightMo Could you please check if the unit tests cover your use case? #817

Thanks for the fix. For me, the /audio/speech interface was missing from the judgment here. I'm not sure if there are other interfaces missing here.

if !containsSubstr([]string{
	"/completions",
	"/embeddings",
	"/chat/completions",
	"/audio/transcriptions",
	"/audio/translations",
	"/images/generations",
}, parseSuffix.Path) {
	return fmt.Sprintf("%s/%s%s?%s", baseURL, azureAPIPrefix, parseSuffix.Path, query.Encode())
}

I couldn't find any information about /audio/speech in the official Azure OpenAI documentation. Could you please provide a reference link to the documentation or further explain the origin and purpose of this endpoint?
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2024-06-01/inference.yaml

@WhiteNightMo
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants