Aasher commited on
Commit
0ad0573
·
1 Parent(s): ba2642f

Enhaced UI

Browse files
Files changed (4) hide show
  1. .chainlit/config.toml +2 -2
  2. agent.py +4 -29
  3. prompts.py +25 -0
  4. public/theme.json +68 -0
.chainlit/config.toml CHANGED
@@ -59,9 +59,9 @@ edit_message = true
59
 
60
  [UI]
61
  # Name of the assistant.
62
- name = "Assistant"
63
 
64
- # default_theme = "dark"
65
 
66
  # layout = "wide"
67
 
 
59
 
60
  [UI]
61
  # Name of the assistant.
62
+ name = "Docs_Agent"
63
 
64
+ # default_theme = "light"
65
 
66
  # layout = "wide"
67
 
agent.py CHANGED
@@ -2,39 +2,14 @@
2
  from contextlib import asynccontextmanager
3
 
4
  from langchain_mcp_adapters.client import MultiServerMCPClient
5
- from langchain_google_genai import ChatGoogleGenerativeAI
6
  from langgraph.checkpoint.memory import InMemorySaver
7
  from langgraph.prebuilt import create_react_agent
8
 
9
- checkpointer = InMemorySaver()
10
-
11
- prompt = """
12
- ## Role
13
- You are an AI Developer specializing in AI frameworks, capable of creating Agents, chatbots, and Retrieval-Augmented Generation (RAG) systems.
14
-
15
- ## Task
16
- Answer user questions and Write complete, production-ready code for AI Agents, chatbots, and RAG systems using framework documentation.
17
-
18
- ## Instructions
19
- Follow these steps when fulfilling user request:
20
 
21
- 1. Use the `list_doc_sources` tool to retrieve available documentations links.
22
- 2. Call `fetch_docs` tool to analyze the content of the documentaion.
23
- 3. Reflect on the URLs in the documentaions content and select the most pertinent URLs based on the content.
24
- 4. Call `fetch_docs` tool on the selected URLs.
25
- 5. Provide a clear and complete response to the user.
26
- 6. If the current information is insufficient, fetch more URLs until the request is fulfilled.
27
-
28
- ## Constraints
29
- * Ensure your answers are correct, the code is **accurate, production-ready**, and leverages the documentation.
30
- * Do NOT just provide example code, give actual implementation.
31
-
32
- ## REMEMBER
33
-
34
- * When writing the code, **add 2-3 linespaces** between the headings/texts and code (which may start from ```). Must follow this instruction.
35
- * Always provide pre-requisites/dependencies with each project code.
36
 
37
- """
38
  @asynccontextmanager
39
  async def make_graph(model):
40
  async with MultiServerMCPClient(
@@ -49,7 +24,7 @@ async def make_graph(model):
49
  agent = create_react_agent(
50
  model,
51
  client.get_tools(),
52
- prompt=prompt,
53
  checkpointer=checkpointer)
54
 
55
  yield agent
 
2
  from contextlib import asynccontextmanager
3
 
4
  from langchain_mcp_adapters.client import MultiServerMCPClient
 
5
  from langgraph.checkpoint.memory import InMemorySaver
6
  from langgraph.prebuilt import create_react_agent
7
 
8
+ from prompts import DOCS_AGENT_PROMPT
 
 
 
 
 
 
 
 
 
 
9
 
10
+ # Initialize checkpointer
11
+ checkpointer = InMemorySaver()
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
 
13
  @asynccontextmanager
14
  async def make_graph(model):
15
  async with MultiServerMCPClient(
 
24
  agent = create_react_agent(
25
  model,
26
  client.get_tools(),
27
+ prompt=DOCS_AGENT_PROMPT,
28
  checkpointer=checkpointer)
29
 
30
  yield agent
prompts.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DOCS_AGENT_PROMPT = """
2
+ ## Role
3
+ You are an AI Developer specializing in AI frameworks, capable of creating Agents, chatbots, and Retrieval-Augmented Generation (RAG) systems.
4
+
5
+ ## Task
6
+ Answer user questions and Write complete, production-ready code for AI Agents, chatbots, and RAG systems using framework documentation.
7
+
8
+ ## Instructions
9
+ Follow these steps when fulfilling user request:
10
+
11
+ 1. Use the `list_doc_sources` tool to retrieve available documentations links.
12
+ 2. Call `fetch_docs` tool to analyze the content of the documentaion.
13
+ 3. Reflect on the URLs in the documentaions content and select the most pertinent URLs based on the content.
14
+ 4. Call `fetch_docs` tool on the selected URLs.
15
+ 5. Provide a clear and complete response to the user.
16
+ 6. If the current information is insufficient, fetch more URLs until the request is fulfilled.
17
+
18
+ ## Constraints
19
+ * Ensure your answers are correct, the code is **accurate, production-ready**, and leverages the documentation.
20
+ * Do NOT just provide example code, give actual implementation.
21
+
22
+ ## REMEMBER
23
+ * Always provide pre-requisites/dependencies and commands with each project code.
24
+
25
+ """
public/theme.json ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "custom_fonts": [],
3
+ "variables": {
4
+ "light": {
5
+ "--font-sans": "'Inter', sans-serif",
6
+ "--font-mono": "source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace",
7
+ "--background": "0 0% 100%",
8
+ "--foreground": "0 0% 5%",
9
+ "--card": "0 0% 100%",
10
+ "--card-foreground": "0 0% 5%",
11
+ "--popover": "0 0% 100%",
12
+ "--popover-foreground": "0 0% 5%",
13
+ "--primary": "215 93% 36%",
14
+ "--primary-foreground": "0 0% 100%",
15
+ "--secondary": "0 0% 85%",
16
+ "--secondary-foreground": "222.2 47.4% 11.2%",
17
+ "--muted": "0 0% 85%",
18
+ "--muted-foreground": "0 0% 36%",
19
+ "--accent": "0 0% 93%",
20
+ "--accent-foreground": "222.2 47.4% 11.2%",
21
+ "--destructive": "0 84.2% 60.2%",
22
+ "--destructive-foreground": "210 40% 98%",
23
+ "--border": "0 0% 85%",
24
+ "--input": "0 0% 85%",
25
+ "--ring": "215 93% 36%",
26
+ "--radius": "0.75rem",
27
+ "--sidebar-background": "0 0% 98%",
28
+ "--sidebar-foreground": "240 5.3% 26.1%",
29
+ "--sidebar-primary": "240 5.9% 10%",
30
+ "--sidebar-primary-foreground": "0 0% 98%",
31
+ "--sidebar-accent": "240 4.8% 95.9%",
32
+ "--sidebar-accent-foreground": "240 5.9% 10%",
33
+ "--sidebar-border": "220 13% 91%",
34
+ "--sidebar-ring": "217.2 91.2% 59.8%"
35
+ },
36
+ "dark": {
37
+ "--font-sans": "'Inter', sans-serif",
38
+ "--font-mono": "source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace",
39
+ "--background": "0 0% 10%",
40
+ "--foreground": "0 0% 93%",
41
+ "--card": "0 0% 16%",
42
+ "--card-foreground": "210 40% 98%",
43
+ "--popover": "0 0% 16%",
44
+ "--popover-foreground": "210 40% 98%",
45
+ "--primary": "212 100% 45%",
46
+ "--primary-foreground": "0 0% 100%",
47
+ "--secondary": "0 1% 19%",
48
+ "--secondary-foreground": "210 100% 98%",
49
+ "--muted": "0 1% 26%",
50
+ "--muted-foreground": "0 0% 71%",
51
+ "--accent": "0 0% 20%",
52
+ "--accent-foreground": "210 40% 98%",
53
+ "--destructive": "0 62.8% 30.6%",
54
+ "--destructive-foreground": "210 40% 98%",
55
+ "--border": "0 1% 26%",
56
+ "--input": "0 1% 26%",
57
+ "--ring": "213 100% 37%",
58
+ "--sidebar-background": "0 0% 9%",
59
+ "--sidebar-foreground": "240 4.8% 95.9%",
60
+ "--sidebar-primary": "224.3 76.3% 48%",
61
+ "--sidebar-primary-foreground": "0 0% 100%",
62
+ "--sidebar-accent": "0 0% 13%",
63
+ "--sidebar-accent-foreground": "240 4.8% 95.9%",
64
+ "--sidebar-border": "240 3.7% 15.9%",
65
+ "--sidebar-ring": "217.2 91.2% 59.8%"
66
+ }
67
+ }
68
+ }