Skip to content

Commit

Permalink
Merge pull request #147 from langchain-ai/nc/jan29/bw-compat
Browse files Browse the repository at this point in the history
Backwards compat
  • Loading branch information
nfcampos authored Jan 29, 2024
2 parents 7d52fc2 + 0f047a7 commit fd4718d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion backend/app/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions backend/app/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/ConfigList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
</span>
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/constants.ts
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down

0 comments on commit fd4718d

Please sign in to comment.