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

Feat/azure inference support #534

Merged
merged 13 commits into from
Aug 29, 2024

Conversation

b4s36t4
Copy link
Contributor

@b4s36t4 b4s36t4 commented Aug 21, 2024

Title:

  • Added support to communicate with azure inference API

Related Issues: (optional)

Copy link
Contributor

@narengogi narengogi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only adding provider field is required

src/providers/azure-ai-inference/complete.ts Outdated Show resolved Hide resolved
src/providers/azure-ai-inference/embed.ts Outdated Show resolved Hide resolved
@b4s36t4
Copy link
Contributor Author

b4s36t4 commented Aug 27, 2024

Stream:

curl --request POST \
  --url <gateway_url>/v1/chat/completions \
  --header 'Authorization: API_KEY' \
  --header 'content-type: application/json' \
  --header 'x-portkey-azure-api-version: 2024-05-01-preview' \
  --header 'x-portkey-azure-deployment-name: Llama-2-7b-chat-cgnkg' \
  --header 'x-portkey-azure-deployment-type: serverless' \
  --header 'x-portkey-azure-region: eastus' \
  --header 'x-portkey-provider: azure-ai' \
  --data '{
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant"
    },
    {
      "role": "user",
      "content": "Hello?"
    }
  ],
  "stream": true
}'

Non-Stream

curl --request POST \
  --url <gateway_url>/v1/chat/completions \
  --header 'Authorization: API_KEY' \
  --header 'content-type: application/json' \
  --header 'x-portkey-azure-api-version: 2024-05-01-preview' \
  --header 'x-portkey-azure-deployment-name: Llama-2-7b-chat-cgnkg' \
  --header 'x-portkey-azure-deployment-type: serverless' \
  --header 'x-portkey-azure-region: eastus' \
  --header 'x-portkey-provider: azure-ai' \
  --data '{
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant"
    },
    {
      "role": "user",
      "content": "Hello?"
    }
  ]
}'

@b4s36t4

This comment was marked as resolved.

Comment on lines +28 to +30
if (azureDeploymentType === 'managed' && azureDeploymentName) {
headers['azureml-model-deployment'] = azureDeploymentName;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VisargD
Copy link
Collaborator

VisargD commented Aug 29, 2024

Can we also add fields in requstValidator schema

@VisargD VisargD merged commit d346014 into Portkey-AI:main Aug 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants