Skip to content

Is it possible to customize openai's api address? #257

Answered by zainhoda
moeik asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can pass in your own OpenAI client object where you specify the endpoint.

class MyVanna(ChromaDB_VectorStore, OpenAI_Chat):
    def __init__(self, config=None):
        ChromaDB_VectorStore.__init__(self, config=config)
        OpenAI_Chat.__init__(self, client=YOUR_OPENAI_CLIENT, config=config) # Make sure to put your AzureOpenAI client here

vn = MyVanna(config={'model': 'gpt-4-...'})

Alternatively, you can set your OPENAI_BASE_URL environment variable

https://github.com/openai/openai-python/blob/main/src/openai/_client.py#L306

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zainhoda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #253 on February 23, 2024 13:50.