Skip to content

Commit

Permalink
Update README and API.md
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnguonly committed Apr 16, 2024
1 parent 6966252 commit 6c1f922
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
31 changes: 30 additions & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ This creates an assistant with the name `"bar"`, with GPT 3.5 Turbo, with a prom
Available tools names can be found in the AvailableTools class in backend/packages/gizmo-agent/gizmo_agent/tools.py
Available llms can be found in GizmoAgentType in backend/packages/gizmo-agent/gizmo_agent/agent_types/__init__.py

Note: If a RAGBot assistant is created (`type` equals `chat_retrieval`), then subsequent API requests/responses for the threads APIs are slightly modified and noted below.

## Create a thread

We can now create a thread.
Expand Down Expand Up @@ -85,7 +87,11 @@ requests.get(
).content
```
```shell
b'{"messages":[]}'
b'{"values":[]}'
```
For RAGBot:
```shell
b'{"values":{"messages":[]}}'
```

Let's add a message to the thread!
Expand All @@ -102,6 +108,17 @@ requests.post(
}
).content
```
For RAGBot:
```
{
"values": {
"messages": [{
"content": "hi! my name is bob",
"type": "human",
}]
}
}
```

If we now run the command to see the thread, we can see that there is now a message on that thread

Expand All @@ -115,6 +132,10 @@ requests.get(
```shell
b'{"values":[{"content":"hi! my name is bob","additional_kwargs":{},"type":"human","example":false}],"next":[]}'
```
For RAGBot:
```shell
b'{"values":{"messages":[...]},"next":[]}'
```

## Run the assistant on that thread

Expand All @@ -141,6 +162,10 @@ requests.get('http://127.0.0.1:8100/threads/231dc7f3-33ee-4040-98fe-27f6e2aa8b2b
```shell
b'{"values":[{"content":"hi! my name is bob","additional_kwargs":{},"type":"human","example":false},{"content":"Hello, Bob! How can I assist you today?","additional_kwargs":{"agent":{"return_values":{"output":"Hello, Bob! How can I assist you today?"},"log":"Hello, Bob! How can I assist you today?","type":"AgentFinish"}},"type":"ai","example":false}],"next":[]}'
```
For RAGBot:
```shell
b'{"values":{"messages":[...]},"next":[]}'
```

## Run the assistant on the thread with new messages

Expand Down Expand Up @@ -171,6 +196,10 @@ requests.get('http://127.0.0.1:8100/threads/231dc7f3-33ee-4040-98fe-27f6e2aa8b2b
```shell
b'{"values":[{"content":"hi! my name is bob","additional_kwargs":{},"type":"human","example":false},{"content":"Hello, Bob! How can I assist you today?","additional_kwargs":{"agent":{"return_values":{"output":"Hello, Bob! How can I assist you today?"},"log":"Hello, Bob! How can I assist you today?","type":"AgentFinish"}},"type":"ai","example":false},{"content":"whats my name? respond in spanish","additional_kwargs":{},"type":"human","example":false},{"content":"Tu nombre es Bob.","additional_kwargs":{"agent":{"return_values":{"output":"Tu nombre es Bob."},"log":"Tu nombre es Bob.","type":"AgentFinish"}},"type":"ai","example":false}],"next":[]}'
```
For RAGBot:
```shell
b'{"values":{"messages":[...]},"next":[]}'
```

## Stream
One thing we can do is stream back responses.
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ This can be a really powerful and flexible architecture. This is probably closes
these also can be not super reliable, and generally only work with the more performant models (and even then they can
mess up). Therefore, we introduced a few simpler architecures.

Assistants are implemented with [LangGraph](https://github.com/langchain-ai/langgraph) `MessageGraph`. A `MessageGraph` is a graph that models its state as a `list` of messages.

**RAGBot**

One of the big use cases of the GPT store is uploading files and giving the bot knowledge of those files. What would it
Expand All @@ -321,6 +323,8 @@ pretty well with a wider variety of models (including lots of open source models
you don’t NEED the flexibility of an assistant (eg you know users will be looking up information every time) then it
can be more focused. And third, compared to the final architecture below it can use external knowledge.

RAGBot is implemented with [LangGraph](https://github.com/langchain-ai/langgraph) `StateGraph`. A `StateGraph` is a generalized graph that can model arbitrary state (i.e. `dict`), not just a `list` of messages.

**ChatBot**

The final architecture is dead simple - just a call to a language model, parameterized by a system message. This allows
Expand All @@ -331,6 +335,8 @@ well.

![](_static/chatbot.png)

ChatBot is implemented with [LangGraph](https://github.com/langchain-ai/langgraph) `StateGraph`. A `StateGraph` is a generalized graph that can model arbitrary state (i.e. `dict`), not just a `list` of messages.

### LLMs

You can choose between different LLMs to use.
Expand Down

0 comments on commit 6c1f922

Please sign in to comment.