Closed azdolinski closed 5 months ago
hey! I just added support for local models through ollama. This doesn't support all of the models you listed, but let me know if this is helpful
@rashadphz My request is not directly releted to local ollama..
LiteLLM hosted locally in docker, allow you connect to multiple vendors (including ollama). It open for you support more then 100+ LLMs, load balance, cost tracking etc. https://docs.litellm.ai/docs/providers
[[farfalle]] ---(OpenAI API)--->[[LiteLLM (docker)]] ---(vendor API)----> [[OpenAI/Gemini/Groq/(ollama) etc..]]
For me - it allow in easy way manage (route logic) connections to multiple ai-clouds/vendors (and keep all api-key in one place).
Got it, just added this to the roadmap.
@rashadphz Great Job! Would you like to add deepseek to the code? I did not find the code how to change api.openai.com to api.deepseek.com T T
If you would like to add this one to the repo, that would be great, or would you like to change the code so that we could change the url of openai locally?
The V2 of deepseek is super cool (In my Chinese literature and logic test, deepseek performs better than gpt-4 and llama3 70b), it's doc is like this:
The DeepSeek API utilizes an API format compatible with OpenAI. By modifying the configuration, you can use the OpenAI SDK to access the DeepSeek API, or employ software that is compatible with the OpenAI API.
Parameters Values
base_url * https://api.deepseek.com/ model deepseek-chat
For compatibility with OpenAI, you may also set the base_url to https://api.deepseek.com/v1 to use.
@rashadphz Great Job! Would you like to add deepseek to the code? I did not find the code how to change api.openai.com to api.deepseek.com T T
If you would like to add this one to the repo, that would be great, or would you like to change the code so that we could change the url of openai locally?
The V2 of deepseek is super cool (In my Chinese literature and logic test, deepseek performs better than gpt-4 and llama3 70b), it's doc is like this:
The DeepSeek API utilizes an API format compatible with OpenAI. By modifying the configuration, you can use the OpenAI SDK to access the DeepSeek API, or employ software that is compatible with the OpenAI API.
Parameters Values
base_url * https://api.deepseek.com/ model deepseek-chat
For compatibility with OpenAI, you may also set the base_url to https://api.deepseek.com/v1 to use.
By the way, the hf page of deepseek v2 is here:
@getofferhelp @azdolinski I found that you can refer to this link to modify line 50 in chat.py within the backend, something like this: return llm = OpenAILike(model="my model", api_base="https://hostname.com/v1", api_key="fake"). Additionally, you need to add OpenAILike to the dependencies. It should be possible to modify the api_base. I plan to try it out first to see if it works.
Link: https://docs.llamaindex.ai/en/latest/api_reference/llms/openai_like/
@getofferhelp @azdolinski I found that you can refer to this link to modify line 50 in chat.py within the backend, something like this: return llm = OpenAILike(model="my model", api_base="https://hostname.com/v1", api_key="fake"). Additionally, you need to add OpenAILike to the dependencies. It should be possible to modify the api_base. I plan to try it out first to see if it works.
Link: https://docs.llamaindex.ai/en/latest/api_reference/llms/openai_like/
Great! Thank you so much! I would try it too.
@getofferhelp @azdolinski I found that you can refer to this link to modify line 50 in chat.py within the backend, something like this: return llm = OpenAILike(model="my model", api_base="https://hostname.com/v1", api_key="fake"). Additionally, you need to add OpenAILike to the dependencies. It should be possible to modify the api_base. I plan to try it out first to see if it works.
Link: https://docs.llamaindex.ai/en/latest/api_reference/llms/openai_like/
I was able to get it working. You don't need OpenAILike, but there are 2 things you need to change.
Line 50 in chat.py needs to be return OpenAI(api_base="https://hostname.com/v1", model=model_mappings[model])
and
Line 24 in related_queries.py needs to be openai.AsyncOpenAI( base_url="https://hostname.com/v1", api_key="fake", ),
From here, you are able to change the name of the model in constants.py, and it should work.
I am having the same problem and changed the lines you suggested and now I get: 500: Error code: 401 - {'error': {'message': 'Incorrect API key provided: fake. You can find your API key at https://platform.openai.com/account/api-keys.','type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Which is wierd, as my AI server doesn't need an API key.
Just added support for all LiteLLM models!
Can you offer some documentation or examples of how to set the config file for LiteLLM models?
1) Please consider adding the environment variable OPENAI_API_URL. This addition will facilitate communication with LiteLLM, which adheres to the OpenAI API protocol and acts as a local proxy. Through this configuration, you'll also gain the capability to connect to Ollama, enabling local LLM interactions.
2) LiteLLM can be deploy as container... and support API method /models [/v1/models] so you can also add read list of models...
Example reponse:
Benefits:
Thank you for considering this enhancement.