mirror of
https://github.com/langchain-ai/opengpts.git
synced 2026-07-01 18:23:41 -04:00
Update README and API.md
This commit is contained in:
@@ -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.
|
||||
@@ -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!
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -331,6 +335,8 @@ well.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user