Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 2 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,49 +119,10 @@ async def main():


asyncio.run(main())

```

A more detailed example can be found [here](examples/studio/chat/chat_completions.py).

### Chat

```python
from ai21 import AI21Client
from ai21.models import RoleType
from ai21.models import ChatMessage

system = "You're a support engineer in a SaaS company"
messages = [
ChatMessage(text="Hello, I need help with a signup process.", role=RoleType.USER),
ChatMessage(text="Hi Alice, I can help you with that. What seems to be the problem?", role=RoleType.ASSISTANT),
ChatMessage(text="I am having trouble signing up for your product with my Google account.", role=RoleType.USER),
]


client = AI21Client()
chat_response = client.chat.create(
system=system,
messages=messages,
model="j2-ultra",
)
```

For a more detailed example, see the chat [examples](examples/studio/chat.py).

### Completion

```python
from ai21 import AI21Client


client = AI21Client()
completion_response = client.completion.create(
prompt="This is a test prompt",
model="j2-mid",
)
```

### Chat Completion

```python
Expand Down Expand Up @@ -276,6 +237,8 @@ run_result = client.beta.maestro.runs.create_and_poll(
],
include=["requirements_result"] # Include additional fields in the result
)

print(run_result)
```

For a more detailed example, see maestro [sync](examples/studio/maestro/run.py) and [async](examples/studio/maestro/async_run.py) examples.
Expand Down
2 changes: 1 addition & 1 deletion examples/studio/maestro/async_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def main():
],
include=["requirements_result"],
)
print(run_result.result)
print(run_result)
except TimeoutError:
print("The run timed out")

Expand Down
Loading