Skip to content

Commit 1818f36

Browse files
authored
Added Assistants Endpoints to README.md
1 parent 935de24 commit 1818f36

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,58 @@ You can also capture the events for a job:
450450
client.finetunes.list_events(id: fine_tune_id)
451451
```
452452

453+
### Assistants
454+
455+
Assistants can call models to interact with threads and use tools to perform tasks (see [Assistant Overview](https://platform.openai.com/docs/assistants/overview).
456+
457+
To create a new assistant (see [API documentation](https://platform.openai.com/docs/api-reference/assistants/createAssistant)):
458+
459+
```
460+
response = client.assistants.create(
461+
parameters: {
462+
model: "gpt-3.5-turbo-1106", # Retrieve via client.models.list. Assistants need 'gpt-3.5-turbo-1106' or later.
463+
name: "OpenAI-Ruby test assistant",
464+
description: nil,
465+
instructions: "You are a helpful assistant for coding a OpenAI API client using the OpenAI-Ruby gem.",
466+
tools: [
467+
{ type: 'retrieval' }, # Allow access to files attached using file_ids
468+
{ type: 'code_interpreter' }, # Allow access to Python code interpreter
469+
],
470+
"file_ids": ["file-123"], # See Files section above for how to upload files
471+
"metadata": { my_internal_version_id: '1.0.0' }
472+
})
473+
assistant_id = response["id"]
474+
```
475+
476+
Given an `assistant_id` you can `retrieve` the current field values:
477+
478+
```
479+
client.assistants.retrieve(id: assistant_id)
480+
```
481+
482+
You can get a `list` of all assistants currently available under the organization:
483+
484+
```
485+
client.assistants.list
486+
```
487+
488+
You can modify an existing assistant using the assistant's id (see [API documentation](https://platform.openai.com/docs/api-reference/assistants/modifyAssistant)):
489+
490+
```
491+
response = client.assistants.modify(
492+
id: assistant_id,
493+
parameters: {
494+
name: "Modified Test Assistant for OpenAI-Ruby",
495+
metadata: { my_internal_version_id: '1.0.1' }
496+
})
497+
```
498+
499+
You can delete assistants:
500+
501+
```
502+
client.assistants.delete(id: assistant_id)
503+
```
504+
453505
### Image Generation
454506

455507
Generate an image using DALL·E! The size of any generated images must be one of `256x256`, `512x512` or `1024x1024` -

0 commit comments

Comments
 (0)