Skip to content
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

Update the Dockerfile of the LiteLLM Proxy server and some refactorings #628

Merged
merged 16 commits into from
Oct 17, 2023

Conversation

coconut49
Copy link
Contributor

@coconut49 coconut49 commented Oct 17, 2023

Description

The purpose of this PR is to fix a number of issues encountered when I trying to deploy LiteLLM Proxy in docker and to do some refactoring of the code.

Tests

Screenshot 2023-10-18 at 01 33 13 Screenshot 2023-10-17 at 23 55 50

I tested the chat completion feature of OpenAI, Azure OpenAI, Bedrock and OpenRouter in my environment, and it worked.

@vercel
Copy link

vercel bot commented Oct 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 17, 2023 5:55pm


RUN python proxy_cli.py --config -f /app/secrets_template.toml

RUN python proxy_cli.py
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't RUN python proxy_cli.py as it will cause the docker build process to get blocked.

@@ -7,7 +7,6 @@
import operator

config_filename = "litellm.secrets.toml"
pkg_config_filename = "template.secrets.toml"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable is not being used.

Comment on lines -241 to -242
except Exception as e:
pass
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors that occur during the loading configuration phase should not be swallowed but should be thrown to let the process exit fast.

Comment on lines +473 to 474
@router.post("/v1/completions")
@router.post("/completions")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic of the two routes is similar, one of which gives default parameters for litellm_completion and the other does not. It's confusing. I've combined them into one function here

Comment on lines 482 to +483
@router.post("/v1/chat/completions")
async def v1_chat_completion(request: Request):
@router.post("/chat/completions")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines +9 to +16
backoff
boto3
uvicorn
fastapi
tomli
appdirs
tomli-w
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirements file looks like it's for docker images, and I want our docker images to contain as many packages as possible so that users don't need to repackage images to install new dependencies

Comment on lines +12 to +13
# add_function_to_prompt = true # e.g: Ollama doesn't support functions, so add it to the prompt instead
# drop_params = true # drop any params not supported by the provider (e.g. Ollama)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Toml, True is the wrong way to write it

@krrishdholakia
Copy link
Contributor

@coconut49 lgtm!

@krrishdholakia krrishdholakia merged commit dbd1d70 into BerriAI:main Oct 17, 2023
@krrishdholakia
Copy link
Contributor

krrishdholakia commented Oct 17, 2023

Your changes to requirements.txt are interesting - presumably this is to deal with the pip install we run only for proxy-specific packages.

@coconut49 You mentioned not wanting your users to deal with this. Can you chat for 10 minutes this week? I'm trying to learn about prod/proxy use-cases.

@coconut49
Copy link
Contributor Author

Hi @krrishdholakia
Sorry, I don't have any current use cases for production environments. I deployed ProxyServer because I have API access to LLMs for various vendors. I wanted to convert them to OpenAI format so I could use them in various ChatUIs.

@coconut49
Copy link
Contributor Author

For example, TypingMind, which I'm using, allows me to add as many LLMs as I want that conform to the OpenAI API format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants