Skip to content

Commit

Permalink
Add an example how to set up the Python client library
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyll committed Sep 9, 2024
1 parent c821b12 commit 79414b9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,24 @@ $ curl http://127.0.0.1:5555/v1/embeddings \
}
```

OpenAI client library could be configured to use the proxy:

```python
client = OpenAI(
base_url="http://127.0.0.1:5555/v1", # or set OPENAI_BASE_URL environmental variable
)

chat_completion = client.chat.completions.create(
model = "gemini-1.5-pro",
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
)
```

### Known OpenAI Limitations

* Only [chat completions](https://platform.openai.com/docs/api-reference/chat) and [embeddings](https://platform.openai.com/docs/api-reference/embeddings/create) are planned to be supported.
Expand Down

0 comments on commit 79414b9

Please sign in to comment.