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

Allow setting can_stream in extra-openai-models.yaml to allow for o1 over proxy #599

Closed
cmungall opened this issue Oct 31, 2024 · 1 comment · Fixed by #600
Closed

Allow setting can_stream in extra-openai-models.yaml to allow for o1 over proxy #599

cmungall opened this issue Oct 31, 2024 · 1 comment · Fixed by #600

Comments

@cmungall
Copy link
Contributor

o1 support was added in response to

However, this hardwires the streamability to named o1 models. I am accessing o1-preview via a (litellm) proxy, so I get a 'message': 'litellm.BadRequestError: AzureException BadRequestError - Error code: 400 - {\'error\': {\'message\': "Unsupported value: \'stream\' does not support true with this model. Only the default (false) value is supported.", \'type\': \'invalid_request_error\'

I believe I need to be able to do this

- model_name: openai/o1
  model_id: lbl/o1
  api_base: <MY PROXY>
  api_key_name: <MY KEY NAME>
  can_stream: false

however, can_stream is currently ignored

cmungall added a commit to cmungall/llm that referenced this issue Oct 31, 2024
Fixes simonw#599 

A longer term fix would be to use something like Pydantic so we don't repeat ourselves, but this would be a bit of a refactor
@simonw simonw closed this as completed in 3b2e526 Nov 6, 2024
@simonw
Copy link
Owner

simonw commented Nov 6, 2024

Here's how I tested this: I added this to my extra-openai-models.yaml file:

- model_id: o1-via-proxy
  model_name: o1-preview
  api_base: "http://localhost:8040/v1"
  api_key_name: openai
  can_stream: false

Then I ran a proxy on port 8040 like this:

uv run --with asgi-proxy-lib==0.2a0 \
  python -m asgi_proxy \
  https://api.openai.com -p 8040 -v

And tested it like this:

llm -m o1-via-proxy 'just say hi' 

Output:

Hi there! How can I assist you today?

While my proxy server showed:

INFO:httpx:HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
INFO:root:Request: POST https://api.openai.com/v1/chat/completions
INFO:root:Response: 200 OK
INFO:     127.0.0.1:52683 - "POST /v1/chat/completions HTTP/1.1" 200 OK

I had to fix this issue first though:

simonw added a commit that referenced this issue Nov 14, 2024
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 a pull request may close this issue.

2 participants