We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I tried to integrate a DeepSeek model deployed on Azure with AzureAIChatCompletionsModel, but I get the error
File site-packages\langchain_azure_ai\chat_models\inference.py", line 500, in _stream choice = chunk.choices[0] IndexError : list index out of range
I guess the API sometimes sends a response with a choices empty list. We could check the size of the list before getting the first item ?
choices
self, messages: List[BaseMessage], stop: Optional[List[str]] = None, run_manager: Optional[CallbackManagerForLLMRun] = None, **kwargs: Any, ) -> Iterator[ChatGenerationChunk]: inference_messages = to_inference_message(messages) default_chunk_class = AIMessageChunk response = self._client.complete( messages=inference_messages, stream=True, stop=stop or self.stop, **self._identifying_params, **kwargs, ) for chunk in response: if len(chunk.choices) > 0: choice = chunk.choices[0] chunk = _convert_delta_to_message_chunk(choice.delta, default_chunk_class) finish_reason = choice.finish_reason generation_info = ( dict(finish_reason=finish_reason) if finish_reason is not None else None ) default_chunk_class = chunk.__class__ # type: ignore[assignment] cg_chunk = ChatGenerationChunk( message=chunk, generation_info=generation_info ) if run_manager: run_manager.on_llm_new_token(cg_chunk.text, chunk=cg_chunk) yield cg_chunk```
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
I tried to integrate a DeepSeek model deployed on Azure with AzureAIChatCompletionsModel, but I get the error
I guess the API sometimes sends a response with a
choices
empty list. We could check the size of the list before getting the first item ?The text was updated successfully, but these errors were encountered: