Skip to content

Commit

Permalink
docs: 📝 update assistant example
Browse files Browse the repository at this point in the history
  • Loading branch information
benshuk committed Jan 20, 2025
1 parent 187c5b1 commit ba0d7d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
11 changes: 3 additions & 8 deletions examples/studio/assistant/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ def main():

assistant = ai21_client.beta.assistants.create(name="My Assistant")

thread = ai21_client.beta.threads.create(
messages=[
{
"role": "user",
"content": "Hello",
},
]
)
thread = ai21_client.beta.threads.create()

ai21_client.beta.threads.messages.create(thread_id=thread.id, role="user", content="Hello")

run = ai21_client.beta.threads.runs.create_and_poll(
thread_id=thread.id,
Expand Down
11 changes: 3 additions & 8 deletions examples/studio/assistant/async_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@ async def main():

assistant = await ai21_client.beta.assistants.create(name="My Assistant")

thread = await ai21_client.beta.threads.create(
messages=[
{
"role": "user",
"content": "Hello",
},
]
)
thread = await ai21_client.beta.threads.create()

await ai21_client.beta.threads.messages.create(thread_id=thread.id, role="user", content="Hello")

run = await ai21_client.beta.threads.runs.create_and_poll(
thread_id=thread.id,
Expand Down

0 comments on commit ba0d7d6

Please sign in to comment.