BerriAI / litellm

Python SDK, Proxy Server (LLM Gateway) to call 100+ LLM APIs in OpenAI format - [Bedrock, Azure, OpenAI, VertexAI, Cohere, Anthropic, Sagemaker, HuggingFace, Replicate, Groq]
https://docs.litellm.ai/docs/
Other
13.62k stars 1.59k forks source link

[Bug]: OIDC is broken for Azure? #3644

Closed Manouchehri closed 5 months ago

Manouchehri commented 5 months ago

What happened?

Not sure what happened, something between my fork of v1.37.0 (working) and v1.37.9 (broken) stopped Azure OpenAI from working with OIDC. Amazon Bedrock still works fine.

model_list:
  - model_name: gpt-4-0125-preview
    litellm_params:
      model: azure/gpt-4-0125-preview
      api_version: "2024-04-01-preview"
      azure_ad_token: "oidc/google/https://example.com"
      api_base: "https://gateway.ai.cloudflare.com/v1/removed/removed/azure-openai/removed-removed"
    model_info:
      base_model: azure/gpt-4-0125-preview

Relevant log output

AzureException - Error code: 401 - {'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'} 

Key Name: `librechat`
Team: `None`
Model: azure/gpt-4-0125-preview
API Base: https://gateway.ai.cloudflare.com/v1/removed/removed/azure-openai/removed-removed
Messages: [{'role': 'user', 'content': 'Morning'}]
model_group: gpt-4-0125-preview

deployment: azure/gpt-4-0125-preview

Twitter / LinkedIn details

https://www.linkedin.com/in/davidmanouchehri/

Manouchehri commented 5 months ago

0887e9cc0d93ca59fa7c46658e9b2a5fad8fbb47 is sus, will look at it later. =)

Manouchehri commented 5 months ago

Yep, reverting 0887e9cc0d93ca59fa7c46658e9b2a5fad8fbb47 fixed it.

ishaan-jaff commented 5 months ago

@Manouchehri it's because match is not supported on Python3.8 and we had issues on CI/CD with it

Manouchehri commented 5 months ago

The change is functionally not the same though, since reverting caused it to behave differently.

Manouchehri commented 5 months ago

Sorry, I am mistaken, it's still broken after reverting that commit. Something else has broken it.

ishaan-jaff commented 5 months ago

let me know the fix - happy to merge it in. Unfortunately I don't have an easy way to test it

Manouchehri commented 5 months ago

Want to hop on a call sometime so I can help walk you through setting up the AWS IAM stuff for #3578 first, and the Azure app stuff for testing this ticket?

It’s probably something your enterprise customers will be interested in having your help set up, so might as well figure it out now. :)

Manouchehri commented 5 months ago

This was a dup of #3695.