weaviate / Verba

Retrieval Augmented Generation (RAG) chatbot powered by Weaviate
BSD 3-Clause "New" or "Revised" License
5.95k stars 634 forks source link

Feat: Please add a config for OpenAI Proxy #145

Closed richard-guan-dev closed 4 days ago

richard-guan-dev commented 4 months ago

System environment value proxy seems not working here. Is that possible to add a proxy config for openai python lib?

Such as:


## Generate by GPT4

import openai
from requests.sessions import Session

# Create a Requests Session instance
session = Session()
session.proxies = {
    'http': 'http://your-proxy-address:port',
    'https': 'http://your-proxy-address:port',
}

# Modify the session used by the OpenAI client
openai.api_requestor._client.session = session

# Now you can use the OpenAI client, and it will make requests through the proxy you configured
response = openai.Completion.create(
  engine="text-davinci-003",
  prompt="Hello, world!",
  max_tokens=5
)

or


openai.proxy = {

        

    'http': 'http://your-proxy-address:port',
        

    'https': 'http://your-proxy-address:port'

        

}
thomashacker commented 4 months ago

Thanks, we're looking into it!

thomashacker commented 4 days ago

Feel free to create a PR for this! 😄 I'm closing this for now