Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
InAnYan committed Nov 5, 2024
1 parent 9ae6281 commit eea65e0
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 0 deletions.
99 changes: 99 additions & 0 deletions module/move/assistant/design/Commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Commands

## Legend

- `<...>` - argument.
- `<..?>` - optional argument.
- `<...=...>` - argument with default value.
- `!` - command requires a set of messages, however that set is hard to encode in CLI.

## OpenAI

### Users

```shell
assistant openai users list
assistant openai users modify <id> <role>
assistant openai users retrieve <id>
assistant openai users delete <id>
```

### Projects

```shell
assistant openai projects list <include_archived=false>
assistant openai projects create <name>
assistant openai projects retrieve <id>
assistant openai projects modify <id> <new_name>
assistant openai projects archive <id>
```

### Project users

```shell
assistant openai project-users list <project_id>
assistant openai project-users create <project_id> <user_id> <role>
assistant openai project-users retrieve <project_id> <user_id>
assistant openai project-users modify <project_id> <user_id> <role>
assistant openai project-users delete <project_id> <user_id>
```

### Project API keys

```shell
assistant openai project-api-keys list <project_id>
assistant openai project-api-keys retrieve <project_id> <key_id>
assistant openai project-api-keys delete <project_id> <key_id>
```

### Assistants

```shell
assistant openai assistants create <model> <name?> <description?> <instructions?>
assistant openai assistants list
assistant openai assistants retrieve <id>
assistant openai assistants modify <id> <model?> <name?> <description?> <instructions?>
assistant openai assistants delete <id>
```

### Threads

```shell
assistant openai threads create
assistant openai threads retrieve <id>
assistant openai threads delete <id>
```

### Messages

```shell
assistant openai messages create <thread_id> <role> <content>
assistant openai messages list <thread_id>
assistant openai messages retrieve <thread_id> <message_id>
assistant openai messages modify <thread_id> <message_id>
assistant openai messages delete <thread_id> <message_id>
```

### Chat

```shell
!assistant openai chat create-completion
```

### Runs

```shell
assistant openai runs create <thread_id> <assistant_id>
assistant openai runs list <thread_id>
assistant openai runs retrieve <thread_id> <run_id>
assistant openai runs cancel <thread_id> <run_id>
```

## Anthropic

### Messages

```shell
!assistant anthropic messages create
```

21 changes: 21 additions & 0 deletions module/move/assistant/design/Entities.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
graph TD
subgraph OpenAI
U[Users]
P[Projects]
PAK[Project API keys]
A[Assistants]
T[Threads]
M[Messages]
R[Runs]

P -- has (through Project Users) --> U
P -- has --> PAK

T -- has --> M

T -- has --> R

A -. are called in .-> R

R -. generate .-> M
end
Binary file added module/move/assistant/design/Entities.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions module/move/assistant/design/Scenarios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Scenarios

## OpenAI

### Projects

#### Create and add users to a new project

```shell
assistant openai projects create 'AnotherAI'
```

Administrator will receive the project ID (referred as `<project_id>`).

Then, to add users to the projects, administrator should know their IDs (referred as `<user1_id>` and `<user2_id>`).

```shell
assistant openai project-users create <project_id> <user1_id> owner
assistant openai project-users create <project_id> <user2_id> member
```

Now, to check that the list of users is filled correctly, one can use:

```shell
assistant openai project-users list <project_id>
```

To list project API keys, one can use:

```shell
assistant openai project-api-keys list <project_id>
```

#### Project "rebranding"

Consider situation:

1. Owner of the organization is changed.
2. New owner decided to rename the project.
3. Also new owner decided to delete and add new employees to the project.

Changing the organization owner is done like this:

```shell
assistant openai users modify <new_onwer_id> owner
assistant openai users modify <old_owner_id> reader
```

To rename the project and reassign employees, these commands are used:

```shell
assistant openai projects modify <project_id> 'AnotherAwesomeAI'
assistant openai project-users delete <project_id> <old_employee_id>
assistant openai project-users create <project_id> <new_employee_id> member
```


### Assistants

#### Make new assistant

```shell
assistant openai assistants create gpt-4o-mini CoolBot 'CoolBot is a helpful assistant.' 'You are a helpful assistant.'
```

This command will return assistant ID.

#### Chat with the assistant

To chat with OpenAI assistant, one should do this:

1. Create a thread. Thread is like a chat.
2. Write a message in thread (e.g. a question).
3. Run the assistant in the thread.

```shell
assistant openai threads create
```

This command will return the new thread ID (referred as `thread_id`). To call an assistant, you need to know its ID.

```shell
assistant openai messages create <thread_id> user '2 + 2 = ?'
assistant openai runs create <thread_id> <assistant_id>
```

0 comments on commit eea65e0

Please sign in to comment.