-
Notifications
You must be signed in to change notification settings - Fork 146
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
Add support for Azure OpenAI, Palm, Claude, Cohere, Replicate, Sagemaker (100+LLMs) - using litellm #174
base: main
Are you sure you want to change the base?
Conversation
@jesse-michael-han @kataqatsi can I get a review on this pr ? happy to add docs/testing if this initial commit looks good |
Hi, thanks for making this PR! This solves a real user problem as evidenced by the multiple issues it addresses and I'd love to get this kind of functionality working in Rift. Could you please add support for users being able to specify the API keys supported by |
@@ -46,6 +46,46 @@ | |||
"default": null, | |||
"description": "OpenAI API key" | |||
}, | |||
"rift.cohereKey": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jesse-michael-han does it make sense to add all the key variables here?
if this is used by the rift UI don't want to fill up the entire section with key configs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that works, now just add corresponding support for setting these env vars in the Python and we should be good to go 👍
@jesse-michael-han done litellm reads the keys directly from the .env so we should be good to go once it's set in the .env |
There is a Quote to much in the dependencies in the pyproject.toml file |
fixed @Patrick10203 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 24681d6
rift-engine/pyproject.toml
Outdated
@@ -32,6 +32,7 @@ dependencies = [ | |||
"aider-chat @ git+https://github.com/morph-labs/aider", | |||
"smol_dev @ git+https://github.com/morph-labs/smol_dev", | |||
"mentat-ai @ git+https://www.github.com/morph-labs/mentat", | |||
"litellm" @ git+https://github.com/BerriAI/litellm/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should instead be:
"litellm @ git+https://github.com/BerriAI/litellm/",
I tried this pull request with the newest version of the main branch of rift and it doesnt work at all. I tried it with Azure Open AI and Open AI, but both dont work anymore after the change of rift-engine/rift/llm/openai_client.py |
endpoint, params=params, input_type=input_type, output_type=output_type | ||
response = completion( | ||
params, | ||
stream=True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stream shouldn't be forced here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if you don't force stream, I think it just doesn't work due to how non-stream responses are handled in rift
Try setting the following environment variables, e.g.: export AZURE_API_KEY=
export AZURE_API_BASE=
export AZURE_API_VERSION=2023-07-01-preview
export AZURE_DEPLOYMENT_NAME= |
@Und3rf10w These env variables where already set before. So it doesnt do anything. I get no response from the rift server when sending a message. Does this work for you? |
) | ||
for chunk in response: | ||
yield chunk # text content found at chunk['choices'][0]['delta'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can not work. The function outside requires a async iterable. Here we create a generator as result of the function. You can not have returns and yields in the same function. Then the Python compiler will think this function always returns a generator. Which is not the case in the other if condition. And so the function chat_completions is never called.
@Patrick10203 You're right, I am not at all able to after trying it out some, sorry for the confusion. |
is this still active? |
Awaiting for these changes to be merged ! |
This PR adds support for the above mentioned LLMs using LiteLLM https://github.com/BerriAI/litellm/
Example