From 7b76dbcfb3ae71262d10a7e0e76093c554f5b167 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Mon, 29 Jan 2024 08:42:36 -0800 Subject: [PATCH 1/2] Rename bot type for backwards compat --- backend/app/agent.py | 2 +- frontend/src/components/Config.tsx | 4 ++-- frontend/src/components/ConfigList.tsx | 4 ++-- frontend/src/constants.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/app/agent.py b/backend/app/agent.py index 6a8103ad..23ea62a3 100644 --- a/backend/app/agent.py +++ b/backend/app/agent.py @@ -268,7 +268,7 @@ def __init__( ) .configurable_alternatives( ConfigurableField(id="type", name="Bot Type"), - default_key="assistant", + default_key="agent", prefix_keys=True, chatbot=chatbot, chat_retrieval=chat_retrieval, diff --git a/frontend/src/components/Config.tsx b/frontend/src/components/Config.tsx index 213e12bb..d1dad7c5 100644 --- a/frontend/src/components/Config.tsx +++ b/frontend/src/components/Config.tsx @@ -321,8 +321,8 @@ export function Config(props: { }, [props.config, props.configDefaults]); useEffect(() => { if (dropzone.acceptedFiles.length > 0) { - if (typeValue === "assistant") { - const toolsKey = "type==assistant/tools"; + if (typeValue === "agent") { + const toolsKey = "type==agent/tools"; setValues((values) => ({ configurable: { ...values?.configurable, diff --git a/frontend/src/components/ConfigList.tsx b/frontend/src/components/ConfigList.tsx index 857a39c3..071e04f2 100644 --- a/frontend/src/components/ConfigList.tsx +++ b/frontend/src/components/ConfigList.tsx @@ -36,8 +36,8 @@ function ConfigItem(props: { { TYPES[ (props.config.config.configurable?.type ?? - "assistant") as keyof typeof TYPES - ].title + "agent") as keyof typeof TYPES + ]?.title } diff --git a/frontend/src/constants.ts b/frontend/src/constants.ts index 4a655202..67835899 100644 --- a/frontend/src/constants.ts +++ b/frontend/src/constants.ts @@ -1,6 +1,6 @@ export const TYPES = { - assistant: { - id: "assistant", + agent: { + id: "agent", title: "Assistant", description: "These GPTs can use an arbitrary number of tools, and you can give them arbitrary instructions. The LLM itself is responsible for deciding which tools to call and how many times to call them. This makes them super powerful and flexible, but they can be unreliable at times! As such, only a subset of the most performant models work with these.", From 0f047a75da5d91b8bd197aa17c24cff15eae853b Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Mon, 29 Jan 2024 08:50:19 -0800 Subject: [PATCH 2/2] Fix backwards compat old threads --- backend/app/checkpoint.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/app/checkpoint.py b/backend/app/checkpoint.py index 5013b3b6..f1589101 100644 --- a/backend/app/checkpoint.py +++ b/backend/app/checkpoint.py @@ -71,8 +71,11 @@ def get(self, config: RunnableConfig) -> Checkpoint | None: value.pop("__pregel_version") value.pop("__pregel_ts") checkpoint = empty_checkpoint() - checkpoint["channel_values"] = value - for key in value: + if value.get("messages"): + checkpoint["channel_values"] = {"__root__": value["messages"][1]} + else: + checkpoint["channel_values"] = {} + for key in checkpoint["channel_values"]: checkpoint["channel_versions"][key] = 1 return checkpoint else: