Open
Description
- Package Name: azure.ai.inference
- Package Version: 1.0.0b9
- Operating System: mac OS Sonama 14.5
- Python Version: 3.13, 3.12, 3.11, 3.10
Describe the bug
I am able to access the chat completion api from AzureOpenAI
but not using azure.ai.inference
To Reproduce
Steps to reproduce the behavior:
- create a virtual env
- install the package using
pip install azure-ai-inference
With from openai import AzureOpenAI
works!
# sample code to connect to azure openai
import os
from openai import AzureOpenAI
API_KEY = os.getenv("AZURE_OPENAI_API_KEY")
API_VERSION = os.getenv("AZURE_OPENAI_API_VERSION")
AZURE_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT")
MODEL_NAME = os.getenv("AZURE_OPENAI_MODEL_NAME")
client = AzureOpenAI(
api_key=API_KEY,
api_version=API_VERSION,
azure_endpoint=AZURE_ENDPOINT,
)
response = client.chat.completions.create(
model=MODEL_NAME,
messages=[{"role": "user", "content": "Hello, world!"}],
)
print(response)
With from azure.ai.inference import ChatCompletionsClient
does not work
import os
from azure.ai.inference import ChatCompletionsClient
from azure.core.credentials import AzureKeyCredential
API_KEY = os.getenv("AZURE_OPENAI_API_KEY")
API_VERSION = os.getenv("AZURE_OPENAI_API_VERSION")
AZURE_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT")
MODEL_NAME = os.getenv("AZURE_OPENAI_MODEL_NAME")
client = ChatCompletionsClient(
endpoint=AZURE_ENDPOINT,
credential=AzureKeyCredential(API_KEY),
api_version=API_VERSION,
)
model_info = client.get_model_info()
print(model_info)
Expected behavior
Both needs to work as expected
Error Message
Traceback (most recent call last):
File "test.py", line 19, in <module>
model_info = client.get_model_info()
^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/azure/ai/inference/_patch.py", line 762, in get_model_info
raise error
File ".venv/lib/python3.12/site-packages/azure/ai/inference/_patch.py", line 759, in get_model_info
self._model_info = self._get_model_info(**kwargs) # pylint: disable=attribute-defined-outside-init
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/azure/ai/inference/_operations/_operations.py", line 472, in _get_model_info
map_error(status_code=response.status_code, response=response, error_map=error_map)
File ".venv/lib/python3.12/site-packages/azure/core/exceptions.py", line 163, in map_error
raise error
azure.core.exceptions.ResourceNotFoundError: (404) Resource not found
Code: 404
Message: Resource not found
Additional context
Metadata
Metadata
Assignees
Labels
Issues related to the client library for Azure AI Model Inference (\sdk\ai\azure-ai-inference)This issue points to a problem in the data-plane of the library.Workflow: This issue is responsible by Azure service team.Issues that are reported by GitHub users external to the Azure organization.Workflow: This issue needs attention from Azure service team or SDK teamThe issue doesn't require a change to the product in order to be resolved. Most issues start as that