File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 44
55import azure .identity
66import openai
7+ import httpx
78
89logger = logging .getLogger ("ragapp" )
910
@@ -52,7 +53,13 @@ async def create_openai_chat_client(
5253 )
5354 else :
5455 logger .info ("Setting up OpenAI client for chat completions using OpenAI.com API key" )
55- openai_chat_client = openai .AsyncOpenAI (api_key = os .getenv ("OPENAICOM_KEY" ))
56+ openai_chat_client = openai .AsyncOpenAI (
57+ api_key = os .getenv ("OPENAICOM_KEY" ),
58+ http_client = openai .DefaultAsyncHttpxClient (
59+ proxy = os .getenv ("OPENAICOM_PROXY" ) or None ,
60+ transport = httpx .HTTPTransport (local_address = "0.0.0.0" ),
61+ )
62+ )
5663
5764 return openai_chat_client
5865
@@ -101,5 +108,11 @@ async def create_openai_embed_client(
101108 )
102109 else :
103110 logger .info ("Setting up OpenAI client for embeddings using OpenAI.com API key" )
104- openai_embed_client = openai .AsyncOpenAI (api_key = os .getenv ("OPENAICOM_KEY" ))
111+ openai_embed_client = openai .AsyncOpenAI (
112+ api_key = os .getenv ("OPENAICOM_KEY" ),
113+ http_client = openai .DefaultAsyncHttpxClient (
114+ proxy = os .getenv ("OPENAICOM_PROXY" ) or None ,
115+ transport = httpx .HTTPTransport (local_address = "0.0.0.0" )
116+ )
117+ )
105118 return openai_embed_client
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export default defineConfig({
2828 } ,
2929 server : {
3030 proxy : {
31- "/chat" : "http://localhost :8000"
31+ "/chat" : "http://127.0.0.1 :8000"
3232 } ,
3333 host : "127.0.0.1" ,
3434 }
You can’t perform that action at this time.
0 commit comments