Skip to content

[BUG] azure_openai_model tools function is not implemented #1802

Closed
@sean186

Description

@sean186

The tools function is not implemented, resulting in the inability to call tools using azure_openai_model.

`
def _run(
self,
messages: List[OpenAIMessage],
response_format: Optional[Type[BaseModel]] = None,
tools: Optional[List[Dict[str, Any]]] = None,
) -> Union[ChatCompletion, Stream[ChatCompletionChunk]]:
r"""Runs inference of Azure OpenAI chat completion.

    Args:
        messages (List[OpenAIMessage]): Message list with the chat history
            in OpenAI API format.

    Returns:
        Union[ChatCompletion, Stream[ChatCompletionChunk]]:
            `ChatCompletion` in the non-stream mode, or
            `Stream[ChatCompletionChunk]` in the stream mode.
    """
    response = self._client.chat.completions.create(
        messages=messages,
        model=self.azure_deployment_name,  # type:ignore[arg-type]
        **self.model_config_dict,
    )
    return response

async def _arun(
    self,
    messages: List[OpenAIMessage],
    response_format: Optional[Type[BaseModel]] = None,
    tools: Optional[List[Dict[str, Any]]] = None,
) -> Union[ChatCompletion, AsyncStream[ChatCompletionChunk]]:
    r"""Runs inference of Azure OpenAI chat completion.

    Args:
        messages (List[OpenAIMessage]): Message list with the chat history
            in OpenAI API format.

    Returns:
        Union[ChatCompletion, AsyncStream[ChatCompletionChunk]]:
            `ChatCompletion` in the non-stream mode, or
            `AsyncStream[ChatCompletionChunk]` in the stream mode.
    """
    response = await self._async_client.chat.completions.create(
        messages=messages,
        model=self.azure_deployment_name,  # type:ignore[arg-type]
        **self.model_config_dict,
    )
    return response`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Task with high level prioritybugSomething isn't workingcall for contribution

    Type

    Projects

    • Status

      No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions