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

feat:Add rest call support similar to oepn-api style #81

Merged
merged 8 commits into from
Sep 20, 2024

Conversation

wuhongsheng
Copy link
Contributor

No description provided.

@rchan26 rchan26 mentioned this pull request Sep 4, 2024
@andimarafioti
Copy link
Member

You're such a goat! Thank you 🙏
With which base_url were you testing this? for me to reproduce

@wuhongsheng
Copy link
Contributor Author

You're such a goat! Thank you 🙏 With which base_url were you testing this? for me to reproduce

I tested it with deepseek url

from openai import OpenAI

client = OpenAI(api_key="", base_url="https://api.deepseek.com")

response = client.chat.completions.create(
model="deepseek-chat",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello"},
],
stream=False
)

print(response.choices[0].message.content)

@SinlinLi
Copy link

SinlinLi commented Sep 5, 2024

a tip: this commit doesn't implement stream transmission.

@MattiPaivike
Copy link

Yes, for this to be useful it should stream the text from the API and create TTS for each chunked text stream. Too much lag if you have to wait for generation of the entire message.

There is an example of how streaming can be implemented in OpenAI Python library:
https://github.com/openai/openai-python?tab=readme-ov-file#streaming-responses

@eustlb eustlb self-assigned this Sep 6, 2024
Copy link
Collaborator

@eustlb eustlb left a comment

Choose a reason for hiding this comment

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

Great work, thanks @wuhongsheng ! 🙏🤗
This will definitely meet a relevant use case.
Almost ready to merge, it just needs to handle the --open_api_stream flag. The suggestion given below to handle it has been tested using --whisper_mlx and --melo, works fine.

arguments_classes/open_api_language_model_arguments.py Outdated Show resolved Hide resolved
LLM/openai_api_language_model.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@wuhongsheng wuhongsheng left a comment

Choose a reason for hiding this comment

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

add sent_tokenize

wuhongsheng

This comment was marked as outdated.

@eustlb
Copy link
Collaborator

eustlb commented Sep 18, 2024

Hey @wuhongsheng, thanks for iterating. Nevertheless, you have not committed suggested changes to handle the --open_api_stream flag, can you do so ? After that, we'll be able to merge 👌

wuhongsheng

This comment was marked as outdated.

@eustlb
Copy link
Collaborator

eustlb commented Sep 20, 2024

LGTM! Thanks for the good work 🤗

@eustlb eustlb merged commit d5e4607 into huggingface:main Sep 20, 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 this pull request may close these issues.

5 participants