dspy
dspy copied to clipboard
fix(dspy): together client response parsing bug + endpoint
I opened up a related issue just now https://github.com/stanfordnlp/dspy/issues/626
Basically I was getting errors when using the Together client. If I set use_chat_api to true, the response did not have an "output" field. Also, if I set use_chat_api to false, I get a 404. These changes fix these issues.
I've only done a smoke test. probably worth at least a smoke test by whoever is reviewing this as well.
Thanks @adam-simple ! LGTM, but @insop do you want to run some checks on this? (since you added the Together client :).
Thank you @arnavsinghvi11 for looping me.
@adam-simple Thank you for the PR.
I was using this API base as follows, and when you use this API_BASE, it was correct in both API URL and the output
.
TOGETHER_API_BASE="https://api.together.xyz/inference"`
But, when I check the API doc, https://api.together.xyz/inference
is deprecated.
So your change is great to remove the deprecated url.
If you could consider the follow two, it will be great.
- could you keep url as is
url = f"{self.api_base}"
, so thatTOGETHER_API_BASE
is set to eitherhttps://api.together.xyz/v1/chat/completions
orhttps://api.together.xyz/v1/completions
- if you could add API doc and the above
TOGETHER_API_BASE
to this document atdocs/api/language_model_clients/Together.md
it will be help others very much.
@adam-simple it's not working I've tried the fix you mentioned can you please inform what did you set for TOGETHER_API_BASE
by using api_base as https://api.together.xyz/v1/chat
by using api_base as https://api.together.xyz/v1
Also tried by using use_chat_api = True
something is wrong with it ig
@someshfengde
Please seem y post above and that's what I was suggesting.
I resolved this issue by using the OpenAI compatability together has. I created another handler for together.
using existing one was too much hassle for me.
If anyone needed here is the branch for fix:
https://github.com/curieo-org/dspy/tree/togetherAPIFIX
Oops I spoke too fast. OK it seems that this is good to go once the issue faced by @someshfengde is fixed
Hi @someshfengde , did you want to add your changes for Together to this PR? maybe the ones that were removed from the other PR?
Hi @someshfengde , did you want to add your changes for Together to this PR? maybe the ones that were removed from the other PR?
I'd have to open a different PR ig? right?
@adam-simple @someshfengde should this PR be closed?