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

Python client: Extra slash in base_uri leads to failures in chat endpoint #1823

Open
2 of 4 tasks
kcarnold opened this issue Apr 27, 2024 · 0 comments
Open
2 of 4 tasks

Comments

@kcarnold
Copy link

kcarnold commented Apr 27, 2024

System Info

If you create a Client with a server URI ending in a slash, the generation endpoint works fine but the chat endpoint fails silently (for the Python client, it's a JSONDecodeError because the server returns a 404 with an empty body, and empty-string isn't valid JSON; that's a separate bug though).

(I'm also confused about the intended relationship between the Python client library in this repo and the InferenceClient one in huggingface_hub. The docs refer to both, in different places.)

Information

  • Docker
  • The CLI directly

Tasks

  • An officially supported command
  • My own modifications

Reproduction

from text_generation import Client
client = Client('http://localhost:3000/')
client.chat(messages=[
    {
        "role": "system",
        "content": "You answer in bulleted lists."
    },
    {
        "role": "user",
        "content": "Why is the sky blue?"
    }
], max_tokens=100)

Expected behavior

Same as if the trailing / in the Client URI is missing.

This could be as simple as self.base_url = base_url.rstrip('/') on:

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

1 participant