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

Dora openai server example #676

Merged
merged 6 commits into from
Oct 7, 2024
Merged

Dora openai server example #676

merged 6 commits into from
Oct 7, 2024

Conversation

haixuanTao
Copy link
Collaborator

You will find in this pull request a quick implementation of an openAI server makes it possible to make request from an openai endpoint client and receive it within the dataflow.

Note that I have only implemented chat completion and this is still experimental.

Get started with:

cd examples/openai-server
dora build dataflow.yml
dora start dataflow.yml

# In a separate terminal
python openai_api_client.py

@haixuanTao haixuanTao force-pushed the dora-openai-server branch 2 times, most recently from 4ae3cc0 to 44b693c Compare October 7, 2024 09:20
@haixuanTao haixuanTao merged commit e1c9d67 into main Oct 7, 2024
39 of 40 checks passed
@haixuanTao haixuanTao deleted the dora-openai-server branch October 7, 2024 12:04
phil-opp added a commit that referenced this pull request Oct 7, 2024
This is a Rust-based version of #676
based on
https://github.com/LlamaEdge/LlamaEdge/tree/main/llama-api-server . It
includes `serde` structs to fully deserialize chat completion requests.

The server replies to requests asynchronously, which makes it possible
to serve multiple clients at the same time. Note that replies are mapped
to requests purely based on their order right now. So the first reply is
assigned to the first request and so on. If the order of replies is
different (e.g. because some completions take longer), some form of ID
needs to be added to the code to enable a proper `request<->reply`
mapping.

Like #676, this PR only implements basic chat completion requests. You
can try it through these steps:

```bash
cd examples/openai-server
dora build dataflow-rust.yml
dora start dataflow-rust.yml

# In a separate terminal
python openai_api_client.py
```

I didn't implement the `/v1/models` endpoint, so the _"Testing API
endpoints..."_ part of `openai_api_client.py` is expected to fail with
_"Error listing models: 404"_.
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.

1 participant