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

[Optimize LiteLLM] - Remove Redundant Client Initalization in completion calls #266

Closed
ishaan-jaff opened this issue Sep 4, 2023 · 3 comments

Comments

@ishaan-jaff
Copy link
Contributor

ishaan-jaff commented Sep 4, 2023

What's the problem? (if there are multiple - list as bullet points)

see:minimaxir/simpleaichat#74

Your implementations for pinging the API and ETLing the I/O are inefficient and would result in a slowdown for simpleaichat.

  • For Anthropic, TogetherAI, Aleph Alpha we always initalize a client and follow that with a completion call. [TODO Action: Remove the need to initialize the Client before every completion call]. If we do 100 completion calls we would have initialize the client 100 times
 together_ai_client = TogetherAILLM(encoding=encoding, api_key=together_ai_key, logging_obj=logging)
            model_response = together_ai_client.completion(
                model=model,
                messages=messages,
                model_response=model_response,
                print_verbose=print_verbose,
                optional_params=optional_params,
                litellm_params=litellm_params,
                logger_fn=logger_fn,
            )

@ishaan-jaff
Copy link
Contributor Author

we should just directly call together_ai.completion()

@ishaan-jaff
Copy link
Contributor Author

ishaan-jaff commented Sep 4, 2023

  • Anthropic
  • Together AI
  • AI21LLM
  • AlephAlphaLLM
  • HuggingfaceRestAPILLM
  • BasetenLLM

@krrishdholakia
Copy link
Contributor

Are we doing anything fancy in here besides just instantiating class variables? Is this what's adding latency?

The logging object is initialized for each completion call - making it thread safe and logging information specific to that call (e.g. model name details), so just make sure we maintain that.

@ishaan-jaff ishaan-jaff changed the title [Optimize LiteLLM] - Remove Redundant Client Initaliaation in completion calls [Optimize LiteLLM] - Remove Redundant Client Initalization in completion calls Sep 4, 2023
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

No branches or pull requests

2 participants