Sample encountered an error: undefined, when using GitHub Models Playground (JavaScript SDK) #172685
Replies: 2 comments
-
|
Hey @ourahma, Below are the few steps to debug the exact issue. 1 - Enhance error logging: log response.status, headers, and body to diagnose. Above steps will provide more details about the issue and certainly you'll be able to find a fix. Let me know it if works! |
Beta Was this translation helpful? Give feedback.
-
|
It looks like the error might be due to how the response is being handled or how the request is structured. A few things to check: Make sure the AzureKeyCredential is correctly imported from @azure/core-auth and your API key has the required model:read scope. Verify that the endpoint https://models.github.ai/inference is reachable from your Node.js environment. Try logging the full response object before calling isUnexpected() to see if there’s an error message returned. Sometimes the SDK wraps errors in a way that response.body.error is undefined. Ensure your messages array is properly structured and non-empty; sometimes an empty or malformed system/user message can cause undefined errors. This is not a widely reported bug, so it’s likely a small mismatch between Playground usage and SDK call. If this helps, please mark this comment as the Accepted Answer. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
Hey,
I am testing the new GitHub Models / Azure AI Inference with the JavaScript SDK (
@azure-rest/ai-inference).I tried to adapt the official sample code from the Playground, but I keep getting the following error:
Example code
Here is the relevant part of my code (almost identical to the sample):
Context
@azure-rest/ai-inference"type": "module")model:readpermission as indicated in the GitHub Models Playground docsQuestion
I would really appreciate any clarification or guidance on this issue. Thanks a lot for your time and support 🙏
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions