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

replace openai base with proxy w/ translation #120

Closed
krrishdholakia opened this issue Aug 15, 2023 · 5 comments
Closed

replace openai base with proxy w/ translation #120

krrishdholakia opened this issue Aug 15, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@krrishdholakia
Copy link
Contributor

There’s a lot of different LLM deployment providers. How do I easily replace my OpenAI base with their url as a proxy? - petals-infra/chat.petals.dev#20, https://www.banana.dev/, etc.

```python
def translate_function(model, messages, max_tokens):
	prompt = " ".join(message["content"] for message in messages)
	max_new_tokens = max_tokens
	return {"model": model, "prompt": prompt, "max_new_tokens": max_new_tokens} 

openai.api_base = litellm.translate_api_call(custom_api_base, translate_function)
```
@krrishdholakia krrishdholakia added the enhancement New feature or request label Aug 15, 2023
@ishaan-jaff
Copy link
Contributor

updates:

  • baseten client/url doesn't work - they have a bunch of auth errors. Reached out to their support for help

@ishaan-jaff
Copy link
Contributor

How would this be possible ?
When you set a url for OpenAI base it expects a server

openai.api_base = "https://localhost:500"

The proposed interface there is a function :

openai.api_base = litellm.translate_api_call(custom_api_base, translate_function)

Open to suggestions on this

@ishaan-jaff
Copy link
Contributor

Tried doing something like this:

def custom_function():
  print("custom function called")

openai.api_base = custom_function

but openai calls @app.route('/chat/completions', methods=["POST"])

@ishaan-jaff
Copy link
Contributor

closing this

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

No branches or pull requests

2 participants