@@ -100,7 +100,7 @@ def __init__(
100100 aclient: Whether to use the asynchronous client.
101101 **kwargs: Additional keyword arguments.
102102 """
103- self .api_key = api_key or os .getenv ("OPENAI_API_KEY" ) or os . getenv ( "MBODI_API_KEY" )
103+ self .api_key = api_key or os .getenv ("OPENAI_API_KEY" )
104104 self .client = client
105105 if self .client is None :
106106 from openai import AsyncOpenAI , OpenAI
@@ -137,7 +137,7 @@ def predict(
137137 **kwargs: Additional keyword arguments.
138138
139139 Returns:
140- str | tuple[str, List[ToolCall]]:
140+ str | tuple[str, List[ToolCall]]:
141141 When tools are not provided: Just the text response
142142 When tools are provided: A tuple of (text_response, tool_calls)
143143 """
@@ -163,12 +163,7 @@ def predict(
163163 return completion .choices [0 ].message .content
164164
165165 def stream (
166- self ,
167- message : Message ,
168- context : List [Message ] = None ,
169- model : str = "gpt-4o" ,
170- tools : List [Tool ] = None ,
171- ** kwargs
166+ self , message : Message , context : List [Message ] = None , model : str = "gpt-4o" , tools : List [Tool ] = None , ** kwargs
172167 ):
173168 """Streams a completion for the given messages using the OpenAI API standard.
174169
@@ -178,7 +173,7 @@ def stream(
178173 model: The model to be used for the completion.
179174 tools: Optional list of tools (function calls) available to the model.
180175 **kwargs: Additional keyword arguments.
181-
176+
182177 Yields:
183178 When tools is None:
184179 str: Content delta chunks
@@ -196,7 +191,7 @@ def stream(
196191 tools = tools ,
197192 ** kwargs ,
198193 )
199-
194+
200195 if not tools :
201196 for chunk in stream :
202197 yield chunk .choices [0 ].delta .content or ""
@@ -208,12 +203,7 @@ def stream(
208203 yield content , tool_calls
209204
210205 async def astream (
211- self ,
212- message : Message ,
213- context : List [Message ] = None ,
214- model : str = "gpt-4o" ,
215- tools : List [Tool ] = None ,
216- ** kwargs
206+ self , message : Message , context : List [Message ] = None , model : str = "gpt-4o" , tools : List [Tool ] = None , ** kwargs
217207 ):
218208 """Streams a completion asynchronously for the given messages using the OpenAI API standard.
219209
@@ -223,7 +213,7 @@ async def astream(
223213 model: The model to be used for the completion.
224214 tools: Optional list of tools (function calls) available to the model.
225215 **kwargs: Additional keyword arguments.
226-
216+
227217 Yields:
228218 When tools is None:
229219 str: Content delta chunks
@@ -243,7 +233,7 @@ async def astream(
243233 tools = tools ,
244234 ** kwargs ,
245235 )
246-
236+
247237 if not tools :
248238 async for chunk in stream :
249239 yield chunk .choices [0 ].delta .content or ""
0 commit comments