Skip to content
New issue

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

Documentation request around Azure endpoint difference and how best to work around it #761

Closed
ekaj2 opened this issue Jan 12, 2025 · 0 comments · Fixed by #771
Closed

Documentation request around Azure endpoint difference and how best to work around it #761

ekaj2 opened this issue Jan 12, 2025 · 0 comments · Fixed by #771
Assignees
Labels
enhancement New feature or request mirascope

Comments

@ekaj2
Copy link

ekaj2 commented Jan 12, 2025

Description

If you just pass your endpoint to the Azure ChatCompletionsClient, it will not work properly with Mirascope (or likely any OpenAI-compatible client). Requests will return something like:

File ".../site-packages/mirascope/core/base/_create.py", line 232, in inner
    response = create(stream=False, **call_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../site-packages/mirascope/core/base/_utils/_get_create_fn_or_async_create_fn.py", line 135, in create_or_stream
    return cast(_NonStreamedResponse, sync_func(**kwargs))
                                      ^^^^^^^^^^^^^^^^^^^
  File ".../site-packages/azure/ai/inference/_patch.py", line 656, in complete
    map_error(status_code=response.status_code, response=response, error_map=error_map)
  File ".../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

Discussed on Slack an easy way to increase DX with an example in the docs or a note about it in the Azure custom client section:

from azure.ai.inference import ChatCompletionsClient
from azure.core.credentials import AzureKeyCredential
from mirascope.core import azure


@azure.call(
    "gpt-4o-mini",
    client=ChatCompletionsClient(
        endpoint="https://my-endpoint.openai.azure.com/openai/deployments/gpt-4o-mini/",
        credential=AzureKeyCredential("...")
    )
)
def hello():
    return "Hello, how are you?"

print(hello())

Ref: https://mirascope-community.slack.com/archives/C072S9P1R38/p1736630556580189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mirascope
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants