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

How to use "response_format": { "type": "json_object" } on azure ai studio serverless endpoint #73

Closed
SaahilClaypool opened this issue Jul 2, 2024 · 1 comment

Comments

@SaahilClaypool
Copy link

When deploying Phi-3-mini-128k-instruct serverless endpoint on azure AI studio and setting the response_format field, the endpoint returns only a stream of newline characters.

I assume this is because the model doesn't support the response_format parameter, but according to the documentation I would think the API would return 422 in that case.

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [x] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

POST https://Phi-3-mini-128k-instruct-serverless.eastus2.inference.ai.azure.com/v1/chat/completions
Content-Type: application/json
Authorization: <key>

{
  "messages": [
    {
      "role": "user",
      "content": "What are the top places in Paris? Respond in JSON with the fields 'location_name', 'location_description'"
    }
  ],
  "response_format": {
    "type": "json_object"
  },
  "temperature": 0.7,
  "max_tokens": 100
}

Response:

{
  "id": "cmpl-efb28e8085204ec3a1d2597c639083f4",
  "object": "chat.completion",
  "created": 1719928871,
  "model": "phi3-mini-128k",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": " \n\n{\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n ",
        "tool_calls": []
      },
      "finish_reason": "length",
      "logprobs": null,
      "stop_reason": null
    }
  ],
  "usage": {
    "prompt_tokens": 28,
    "total_tokens": 128,
    "completion_tokens": 100
  }
}
@leestott
Copy link
Contributor

leestott commented Jul 4, 2024

Hi @SaahilClaypool see https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-phi-3?tabs=phi-3-mini

Consume Phi-3 models as a service
Models deployed as serverless APIs can be consumed using the chat API, depending on the type of model you deployed.

From your Project overview page, go to the left sidebar and select Components > Deployments.

Find and select the deployment you created.

Copy the Target URL and the Key value.

Make an API request using the /v1/chat/completions API using <target_url>/v1/chat/completions. For more information on using the APIs, see the Reference: Chat Completions.

@leestott leestott closed this as completed Jul 5, 2024
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

No branches or pull requests

2 participants