This commit is contained in:
bracesproul
2025-03-13 17:11:01 -07:00
parent 2d5c7f5d54
commit 4941bd6d97
12 changed files with 27 additions and 21 deletions
+1 -1
View File
@@ -214,4 +214,4 @@ Configuration auto-generated by `langgraph template lock`. DO NOT EDIT MANUALLY.
}
}
}
-->
-->
@@ -61,4 +61,4 @@ describe("Memory Graph", () => {
},
30000,
);
});
});
@@ -8,4 +8,4 @@ describe("Configuration", () => {
expect(result).toBeDefined();
expect(typeof result).toBe("object");
});
});
});
+1 -1
View File
@@ -1,3 +1,3 @@
# Agent App
# TODO: ADD README
# TODO: ADD README
+2 -4
View File
@@ -1,8 +1,6 @@
{
"node_version": "20",
"dependencies": [
"."
],
"dependencies": ["."],
"graphs": {},
"env": ".env"
}
}
+3 -1
View File
@@ -2,7 +2,9 @@
"name": "agent-app",
"author": "Your Name",
"private": true,
"workspaces": ["apps/*"],
"workspaces": [
"apps/*"
],
"scripts": {
"dev": "turbo dev --filter=web --filter=agents",
"build": "turbo build",
+1 -1
View File
@@ -233,4 +233,4 @@ Configuration auto-generated by `langgraph template lock`. DO NOT EDIT MANUALLY.
}
}
}
-->
-->
+15 -7
View File
@@ -8,14 +8,18 @@ This is a starter project to help you get started with developing a RAG research
This project has three graphs:
* an "index" graph (`src/index_graph/graph.ts`)
* a "retrieval" graph (`src/retrieval_graph/graph.ts`)
* a "researcher" subgraph (part of the retrieval graph) (`src/retrieval_graph/researcher_graph/graph.ts`)
- an "index" graph (`src/index_graph/graph.ts`)
- a "retrieval" graph (`src/retrieval_graph/graph.ts`)
- a "researcher" subgraph (part of the retrieval graph) (`src/retrieval_graph/researcher_graph/graph.ts`)
The index graph takes in document objects indexes them.
```json
[{ "page_content": "LangGraph is a library for building stateful, multi-actor applications with LLMs, used to create agent and multi-agent workflows." }]
[
{
"page_content": "LangGraph is a library for building stateful, multi-actor applications with LLMs, used to create agent and multi-agent workflows."
}
]
```
If an empty list is provided (default), a list of sample documents from `src/sample_docs.json` is indexed instead. Those sample documents are based on the conceptual guides for LangChain and LangGraph.
@@ -24,12 +28,16 @@ The retrieval graph manages a chat history and responds based on the fetched doc
1. Takes a user **query** as input
2. Analyzes the query and determines how to route it:
- if the query is about "LangChain", it creates a research plan based on the user's query and passes the plan to the researcher subgraph
- if the query is ambiguous, it asks for more information
- if the query is general (unrelated to LangChain), it lets the user know
3. If the query is about "LangChain", the researcher subgraph runs for each step in the research plan, until no more steps are left:
- it first generates a list of queries based on the step
- it then retrieves the relevant documents in parallel for all queries and return the documents to the retrieval graph
4. Finally, the retrieval graph generates a response based on the retrieved documents and the conversation context
## Getting Started
@@ -261,8 +269,8 @@ You can customize this retrieval agent template in several ways:
5. **Modify prompts**: Update the prompts used for user query routing, research planning, query generation and more in `src/retrieval_graph/prompts.ts` to better suit your specific use case or to improve the agent's performance. You can also modify these directly in LangGraph Studio. For example, you can:
* Modify system prompt for creating research plan (`research_plan_system_prompt`)
* Modify system prompt for generating search queries based on the research plan (`generate_queries_system_prompt`)
- Modify system prompt for creating research plan (`research_plan_system_prompt`)
- Modify system prompt for generating search queries based on the research plan (`generate_queries_system_prompt`)
6. **Change the language model**: Update the `response_model` in the configuration to use different language models for response generation. Options include various Claude models from Anthropic, as well as models from other providers like Fireworks AI.
@@ -712,4 +720,4 @@ Configuration auto-generated by `langgraph template lock`. DO NOT EDIT MANUALLY.
}
}
}
-->
-->
@@ -175,4 +175,3 @@ const builder = new StateGraph(
export const graph = builder
.compile()
.withConfig({ runName: "RetrievalGraph" });
@@ -66,4 +66,3 @@ const builder = new StateGraph({
export const graph = builder
.compile()
.withConfig({ runName: "ResearcherGraph" });
@@ -37,7 +37,7 @@ type Router = {
type: "more-info" | "langchain" | "general";
};
/**
/**
* Represents the state of the retrieval graph / agent.
*/
export const AgentStateAnnotation = Annotation.Root({
+1 -1
View File
@@ -697,4 +697,4 @@ Configuration auto-generated by `langgraph template lock`. DO NOT EDIT MANUALLY.
}
}
}
-->
-->