diff --git a/just_agents/streaming/openai_streaming.py b/just_agents/streaming/openai_streaming.py index 25a0faf..9cf7c99 100644 --- a/just_agents/streaming/openai_streaming.py +++ b/just_agents/streaming/openai_streaming.py @@ -15,6 +15,8 @@ async def resp_async_generator(self, memory: Memory, key_getter: Callable[[], str] = None ) -> AsyncGenerator[str, None]: api_key = key_getter() if key_getter is not None else None + if api_key is None: + api_key = options.pop("api_key", None) response: ModelResponse = completion(messages=memory.messages, stream=True, api_key=api_key, **options) parser: Optional[FunctionParser] = None tool_messages: list[Message] = [] diff --git a/just_agents/streaming/qwen_streaming.py b/just_agents/streaming/qwen_streaming.py index 5010bea..a800847 100644 --- a/just_agents/streaming/qwen_streaming.py +++ b/just_agents/streaming/qwen_streaming.py @@ -95,6 +95,9 @@ async def resp_async_generator(self, memory: Memory, options: Dict, available_to :return: """ api_key = key_getter() if key_getter is not None else None + if api_key is None: + api_key = options.pop("api_key", None) + response: ModelResponse = completion(messages=memory.messages, stream=True, api_key=api_key, **options) parser: QwenFunctionParser = QwenFunctionParser() deltas: list[str] = []