This project aims to create a tool that can generate custom charts and Quickbase queries based on user prompts. The tool utilizes the power of large language models, specifically LangChain and LangGraph, along with the OpenAI GPT-4o model, to understand user requests and generate the appropriate outputs.
- install python 3.10
pip install -r requirements.txt
python langgraph-demo.py
python bedrock-agent-demo.py
- set
b_langgraph_agent = True
to see the results of langgraph
Displays the number of works orders assigned to each staff member
{
"chartType": "bar",
"description": "Displays the number of works orders assigned to each staff member",
"groupBy": {
"field": "Related Staff Member"
},
"name": "Works Orders by Staff Member",
"table": "Works Orders",
"yAxes": [
{
"aggregateFunction": "count"
}
]
}
6 Belongs to 'Tasks'
query=({'6'.EX.'Tasks'})
{
"chartType": "bar",
"description": "Displays the number of works orders assigned to each staff member",
"groupBy": {
"field": "Related Staff Member"
},
"name": "Works Orders by Staff Member",
"table": "Works Orders",
"yAxes": [
{
"aggregateFunction": "count"
}
]
}
YES
The generated chart JSON information is correct. Here is the breakdown:
1. **chartType**: "bar" - This is appropriate for displaying counts.
2. **description**: "Displays the number of works orders assigned to each staff member" - This matches the user request.
3. **groupBy**:
- **field**: "Related Staff Member" - This is the correct field to group by to show the number of works orders assigned to each staff member.
4. **name**: "Works Orders by Staff Member" - This is a suitable name for the chart.
5. **table**: "Works Orders" - This is the correct table to use.
6. **yAxes**:
- **aggregateFunction**: "count" - This is the correct aggregate function to count the number of works orders.
- Prompt-based Chart Generation: Users can provide natural language prompts, and the tool will generate the corresponding Quickbase chart configuration with app schema.
- Prompt-based Query Generation: Users can provide natural language prompts describing the desired data query, and the tool will generate the corresponding Quickbase query.
- Role-based Prompting: The tool can tailor its responses based on the user's role (e.g., analyst, manager, executive) to provide more relevant and tailored outputs.
- Few-shot Learning: The tool can leverage a small number of example prompts and outputs to quickly adapt to new user requests, improving its performance over time.
- Knowledge Scaling: When the underlying knowledge base becomes larger, the tool can utilize the Retrieval Augmented Generation (RAG) architecture to efficiently retrieve and integrate relevant information into the generated outputs.
- Python 3.10: The programming language used for the project.
- LangChain: A framework for building applications with large language models.
- LangGraph: A tool for integrating knowledge graphs into language models.
- OpenAI GPT-4o: A powerful large language model used for generating charts and queries.
- model : Claude 2.1
- Instruction for the Chart Agent :
You should learn from provided examples. What you should learn: 1. Output Schema. 2. How to determine chartType from user request. 3. How to determine table to answer user request. 4. How to determine field to group by. 5. How to determine aggregate function. Here's additional information: 1. chartType: bar, line, pie 2. aggregateFunction: sum, average, count. Double check your work.
- Instruction for the Query Agent :
You are a agent generating Quickbase query correponding to user request. Please learn rules from provided examples. Pleae make sure to follow the rules. Double check your work.
- click
Edit in Agent Builder
button - scroll down, in advanced prompts section,
click Edit
button - click
Ochestration
tab, add prompt (<app_schema>) - add prompt (<example_schema>)
- agentID
- agentAliasID
Contributions to this project are welcome. If you have any ideas, bug fixes, or feature enhancements, please feel free to submit a pull request or open an issue.