fix(settings): Add fallback in case models httpRequest returns a JsonArray instead of JsonObject #146
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wanted to have support for https://www.together.ai/. However, AI Commits did not work with this endpoint out the box. I found out that the results from the "models" call differed.
From OpenAI, a call to
https://api.openai.com/v1/models
looked something like this:Where as Together.ai, a call to
https://api.together.xyz/v1/models
looked something like this:So, I ended up trying openai.models() first, and if it failed, fall back to parsing the jsonarray manually. Which leads me to another pain point, which was that
owned_by
is also not present in together.ai's model. So fallback only requiresid
andcreated
.If this is helpful to others, feel free to use this. Here's a video of it in action...
java_zuqwE6Wfgr.mp4