Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
herumes committed Jun 8, 2024
1 parent ef859d7 commit 482b3ef
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,44 @@ pip install poetry
poetry install
```

## Getting Started

### Synchronous Client

```python
from shuttleai import ShuttleAI

shuttleai = ShuttleAI()

for chunk in shuttleai.chat.completions.create(
messages=[{"role": "user", "content": "Imagine an AI like no other, its name is ShuttleAI."}],
stream=True
):
print(chunk.choices[0].delta.content, end="", flush=True)
```

### Asynchronous Client

```python
import asyncio
from shuttleai import AsyncShuttleAI

async def main():
shuttleai = AsyncShuttleAI()

async for chunk in shuttleai.chat.completions.create(
messages=[{"role": "user", "content": "Imagine an AI like no other, its name is ShuttleAI."}],
stream=True
):
print(chunk.choices[0].delta.content, end="", flush=True)

asyncio.run(main())
```

### Interactive Chatbot

Scroll down to the [Interactive Chatbot](#interactive-chatbot) section for more information.

## Run examples

You can run the examples in the `examples/` directory using `poetry run` or by entering the virtual environment using `poetry shell`.
Expand Down

0 comments on commit 482b3ef

Please sign in to comment.