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

Add ability to customize "/chat/completions" path after base url #1344

Open
1 task done
LukeSamkharadze opened this issue Apr 18, 2024 · 0 comments
Open
1 task done

Comments

@LukeSamkharadze
Copy link

Confirm this is a feature request for the Python library and not the underlying OpenAI API.

  • This is a feature request for the Python library

Describe the feature or improvement you're requesting

Some providers have custom endpoint for calling models.

For ex https://api.minimax.chat/v1/text/chatcompletion_v2

If we used python library with base url of https://api.minimax.chat/v1 final request is being made on https://api.minimax.chat/v1/chat/completions which doesn't exist.

Instead of hardcoding path /chat/completions param So lets add option for specifying custom path.

Example:

from openai import OpenAI
client = OpenAI()

completion = client.chat.completions.create(
  model="custom_model",
  messages=[
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  custom_path="text/chatcompletion_v2"
)

print(completion.choices[0].message)

Additional context

No response

@swapdewalkar swapdewalkar mentioned this issue Apr 22, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant