lynxkite / examples /Graph RAG
darabos's picture
Update NetworkX demo to be error-free. Sort keys in workspaces. Autoformat some files.
b133985
raw
history blame
26.8 kB
{
"env": "LLM logic",
"nodes": [
{
"id": "Input document 1",
"type": "basic",
"data": {
"title": "Input document",
"params": {
"filename": "examples/example-pizza.md"
},
"display": null,
"error": null,
"__execution_delay": 0.0,
"meta": {
"type": "basic",
"params": {
"filename": {
"type": {
"format": "path"
},
"name": "filename",
"default": null
}
},
"inputs": {},
"name": "Input document",
"outputs": {
"output": {
"name": "output",
"type": {
"type": "None"
},
"position": "right"
}
}
},
"collapsed": null
},
"position": {
"x": -1138.7178641442829,
"y": -307.0280242240266
},
"parentId": null,
"width": 290.0,
"height": 217.0
},
{
"id": "View 1",
"type": "table_view",
"data": {
"title": "View",
"params": {},
"display": {
"dataframes": {
"df": {
"columns": [
"text"
],
"data": [
[
"hello"
],
[
"### 1. **Overview**"
],
[
"This document outlines the pricing structure and available options for our pizza delivery service. The goal is to provide clear guidance on the pricing tiers, additional offerings, and optional extras to ensure consistency across all locations and platforms (phone, online, in-app). All pricing is based on current market trends, food costs, and competitive analysis."
],
[
"---"
],
[
"### 2. **Pizza Options**"
],
[
"#### 2.1 **Size & Base Pricing**"
],
[
"| Size | Diameter | Price (Cheese Pizza) |\n|------------------|------------|----------------------|\n| Small | 10 inches | $8.99 |\n| Medium | 12 inches | $11.99 |\n| Large | 14 inches | $14.99 |\n| Extra Large | 16 inches | $17.99 |"
],
[
"**Note**: Cheese pizza pricing includes sauce and cheese. Toppings are additional (see section 2.3)."
],
[
"#### 2.2 **Crust Options**"
],
[
"| Crust Type | Description | Price Adjustment |\n|------------------|------------------------------------------|------------------|\n| Classic Hand-Tossed | Soft, airy texture | No Change |\n| Thin & Crispy | Light and crunchy | No Change |\n| Stuffed Crust | Filled with mozzarella | +$2.00 (M-XL) |\n| Gluten-Free | 10\" only; made with rice flour | +$2.50 (Small Only) |"
],
[
"---"
],
[
"### 3. **Toppings**"
],
[
"#### 3.1 **Standard Toppings**\n**Price per topping:**"
],
[
"- Small: $1.00\n- Medium: $1.50\n- Large: $2.00\n- Extra Large: $2.50"
],
[
"| Topping | Category |\n|------------------|----------------|\n| Pepperoni | Meat |\n| Sausage | Meat |\n| Mushrooms | Vegetable |\n| Onions | Vegetable |\n| Bell Peppers | Vegetable |\n| Olives | Vegetable |\n| Extra Cheese | Dairy |"
],
[
"#### 3.2 **Premium Toppings**\n**Price per topping:**"
],
[
"- Small: $1.75\n- Medium: $2.25\n- Large: $2.75\n- Extra Large: $3.25"
],
[
"| Topping | Category |\n|------------------|----------------|\n| Grilled Chicken | Meat |\n| Bacon | Meat |\n| Sun-Dried Tomatoes| Vegetable |\n| Artichoke Hearts | Vegetable |\n| Feta Cheese | Dairy |\n| Vegan Cheese | Dairy Alternative |"
],
[
"---"
],
[
"### 4. **Specialty Pizzas**"
],
[
"Specialty pizzas include a combination of premium toppings and are available in all sizes. Prices below are for Medium size, with additional costs for upgrading to larger sizes."
],
[
"| Pizza Name | Description | Price (Medium) |\n|----------------------|----------------------------------------------------|-----------------|\n| Meat Lover’s | Pepperoni, sausage, bacon, ham | $16.99 |\n| Veggie Delight | Mushrooms, bell peppers, onions, olives | $14.99 |\n| BBQ Chicken | BBQ sauce, grilled chicken, red onions, cilantro | $17.99 |\n| Margherita | Fresh mozzarella, tomatoes, basil | $15.99 |\n| Hawaiian | Ham, pineapple | $14.99 |"
],
[
"---"
],
[
"### 5. **Additional Menu Items**"
],
[
"#### 5.1 **Side Orders**"
],
[
"| Item | Description | Price |\n|--------------------|--------------------------------------|---------------|\n| Garlic Breadsticks | Served with marinara dipping sauce | $5.99 |\n| Chicken Wings | Buffalo, BBQ, or plain (10 pieces) | $9.99 |\n| Mozzarella Sticks | Served with marinara (8 pieces) | $6.99 |\n| Caesar Salad | Romaine, croutons, Caesar dressing | $7.99 |"
],
[
"#### 5.2 **Desserts**"
],
[
"| Item | Description | Price |\n|--------------------|--------------------------------------|---------------|\n| Chocolate Brownies | Chewy and rich (6 pieces) | $4.99 |\n| Cinnamon Sticks | Dusted with cinnamon sugar | $5.99 |"
],
[
"---"
],
[
"### 6. **Drinks**"
],
[
"| Size | Price |\n|--------------------|---------------|\n| 20 oz Bottle | $1.99 |\n| 2-Liter Bottle | $3.50 |"
],
[
"Available options: Coke, Diet Coke, Sprite, Root Beer, Lemonade."
],
[
"---"
],
[
"### 7. **Delivery Fees & Minimum Order**"
],
[
"- **Delivery Fee**: $2.99\n- **Minimum Order**: $12.00"
],
[
"*Note: Delivery fees and minimum order thresholds apply to all delivery orders within a 5-mile radius. Additional charges may apply for orders outside this zone.*"
],
[
"---"
],
[
"### 8. **Promotions & Discounts**"
],
[
"- **Monday Madness**: Buy one large pizza, get a second pizza for 50% off.\n- **Student Discount**: 10% off with valid student ID (pickup only).\n- **Family Deal**: 2 large pizzas, 1 side, and 2-liter soda for $29.99."
],
[
"---"
],
[
"### 9. **Conclusion**"
],
[
"This pricing and menu structure is designed to offer a wide range of choices for our customers while maintaining competitive pricing and ensuring profitability. Please ensure all team members are familiar with the details in this document and implement it accordingly.\n"
]
]
}
}
},
"error": null,
"meta": {
"name": "View",
"inputs": {
"input": {
"name": "input",
"type": {
"type": "<class 'inspect._empty'>"
},
"position": "left"
}
},
"outputs": {},
"params": {},
"type": "table_view"
},
"beingResized": false
},
"position": {
"x": 320.42256477431704,
"y": -562.3096858852143
},
"parentId": null,
"width": 909.0,
"height": 367.0
},
{
"id": "Split document 1",
"type": "basic",
"data": {
"title": "Split document",
"params": {
"delimiter": "\\n\\n"
},
"display": null,
"error": null,
"meta": {
"params": {
"delimiter": {
"name": "delimiter",
"type": {
"type": "<class 'str'>"
},
"default": "\\n\\n"
}
},
"type": "basic",
"inputs": {
"input": {
"type": {
"type": "<class 'inspect._empty'>"
},
"position": "left",
"name": "input"
}
},
"name": "Split document",
"outputs": {
"output": {
"name": "output",
"type": {
"type": "None"
},
"position": "right"
}
}
}
},
"position": {
"x": -671.5138580866221,
"y": -394.5831190981944
},
"parentId": null,
"height": 200.0,
"width": 200.0
},
{
"id": "Input chat 1",
"type": "basic",
"data": {
"title": "Input chat",
"params": {
"chat": "What's your cheapest drink?"
},
"display": null,
"error": null,
"__execution_delay": 0.0,
"meta": {
"type": "basic",
"name": "Input chat",
"params": {
"chat": {
"name": "chat",
"default": null,
"type": {
"type": "<class 'str'>"
}
}
},
"inputs": {},
"outputs": {
"output": {
"position": "right",
"type": {
"type": "None"
},
"name": "output"
}
}
},
"collapsed": null,
"beingResized": false
},
"position": {
"x": -1169.0221491975267,
"y": 142.6860253469853
},
"parentId": null,
"width": 347.0,
"height": 197.0
},
{
"id": "Create prompt 1",
"type": "basic",
"data": {
"title": "Create prompt",
"params": {
"template": "\n{% for item in rag %}\n---\n{{item}}\n{% endfor %}\n---\nIs the information above sufficient to answer the following question?\n- {{text}}\n\nIf the information is insufficient please say so. Otherwise, provide the answer.",
"save_as": "prompt"
},
"display": null,
"error": null,
"collapsed": null,
"__execution_delay": 0.0,
"meta": {
"name": "Create prompt",
"inputs": {
"input": {
"position": "left",
"type": {
"type": "<class 'inspect._empty'>"
},
"name": "input"
}
},
"outputs": {
"output": {
"name": "output",
"position": "right",
"type": {
"type": "None"
}
}
},
"params": {
"save_as": {
"type": {
"type": "<class 'str'>"
},
"default": "prompt",
"name": "save_as"
},
"template": {
"default": null,
"type": {
"format": "textarea"
},
"name": "template"
}
},
"type": "basic"
}
},
"position": {
"x": 324.81988008998496,
"y": -9.071826950189632
},
"height": 362.0,
"parentId": null,
"width": 270.0
},
{
"id": "RAG 1",
"type": "basic",
"data": {
"title": "RAG",
"params": {
"engine": "Custom",
"db_field": "text",
"input_field": "text",
"num_matches": "1"
},
"display": null,
"error": null,
"meta": {
"name": "RAG",
"params": {
"input_field": {
"name": "input_field",
"default": "text",
"type": {
"type": "<class 'str'>"
}
},
"db_field": {
"name": "db_field",
"default": "text",
"type": {
"type": "<class 'str'>"
}
},
"engine": {
"type": {
"enum": [
"Chroma",
"Custom"
]
},
"name": "engine",
"default": "RagEngine.Chroma"
},
"num_matches": {
"type": {
"type": "<class 'int'>"
},
"name": "num_matches",
"default": 10.0
}
},
"outputs": {
"output": {
"name": "output",
"type": {
"type": "None"
},
"position": "right"
}
},
"inputs": {
"input": {
"type": {
"type": "<class 'inspect._empty'>"
},
"name": "input",
"position": "left"
},
"db": {
"name": "db",
"type": {
"type": "<class 'inspect._empty'>"
},
"position": "top"
}
},
"type": "basic"
}
},
"position": {
"x": -645.0268659124858,
"y": 44.3669514323544
},
"parentId": null,
"width": 423.0,
"height": 424.0
},
{
"id": "View 3",
"type": "table_view",
"data": {
"title": "View",
"params": {},
"display": {
"dataframes": {
"df": {
"columns": [
"text",
"rag"
],
"data": [
[
"What's your cheapest drink?",
[
"### 6. **Drinks**"
]
]
]
}
}
},
"error": null,
"beingResized": false,
"meta": {
"name": "View",
"params": {},
"inputs": {
"input": {
"type": {
"type": "<class 'inspect._empty'>"
},
"position": "left",
"name": "input"
}
},
"outputs": {},
"type": "table_view"
}
},
"position": {
"x": -43.795911596608875,
"y": 457.1809102819045
},
"parentId": null,
"width": 296.0,
"height": 228.0
},
{
"id": "Ask LLM 1",
"type": "basic",
"data": {
"title": "Ask LLM",
"params": {
"max_tokens": 100.0,
"accepted_regex": "",
"model": "SultanR/SmolTulu-1.7b-Instruct"
},
"display": null,
"error": null,
"collapsed": null,
"__execution_delay": 0.0,
"meta": {
"inputs": {
"input": {
"position": "left",
"name": "input",
"type": {
"type": "<class 'inspect._empty'>"
}
}
},
"params": {
"accepted_regex": {
"type": {
"type": "<class 'str'>"
},
"default": null,
"name": "accepted_regex"
},
"max_tokens": {
"name": "max_tokens",
"default": 100.0,
"type": {
"type": "<class 'int'>"
}
},
"model": {
"type": {
"type": "<class 'str'>"
},
"default": null,
"name": "model"
}
},
"outputs": {
"output": {
"type": {
"type": "None"
},
"position": "right",
"name": "output"
}
},
"name": "Ask LLM",
"type": "basic"
}
},
"position": {
"x": 649.0730411878703,
"y": 29.290926423828694
},
"height": 329.0,
"width": 249.0,
"parentId": null
},
{
"id": "View 4",
"type": "table_view",
"data": {
"title": "View",
"params": {},
"display": {
"dataframes": {
"df": {
"columns": [
"text",
"rag",
"prompt",
"response"
],
"data": [
[
"What's your cheapest drink?",
[
"### 6. **Drinks**",
"| Size | Price |\n|--------------------|---------------|\n| 20 oz Bottle | $1.99 |\n| 2-Liter Bottle | $3.50 |",
"Available options: Coke, Diet Coke, Sprite, Root Beer, Lemonade."
],
"\n\n---\n### 6. **Drinks**\n\n---\n| Size | Price |\n|--------------------|---------------|\n| 20 oz Bottle | $1.99 |\n| 2-Liter Bottle | $3.50 |\n\n---\nAvailable options: Coke, Diet Coke, Sprite, Root Beer, Lemonade.\n\n---\nIs the information above sufficient to answer the following question?\n- What's your cheapest drink?\n\nIf the information is insufficient please say so. Otherwise, provide the answer.",
"The provided information is sufficient to answer the question:\n\n- **Cheapest Drink:** \n\nThe cheapest drink is the 20 oz Bottle of Coke, which costs $1.99.\n\n**Why?**\n- The 20 oz Bottle of Coke is the only option listed with a price of $1.99, making it the most cost-effective option among the given drink sizes and prices."
]
]
}
}
},
"error": null,
"meta": {
"outputs": {},
"type": "table_view",
"params": {},
"inputs": {
"input": {
"position": "left",
"type": {
"type": "<class 'inspect._empty'>"
},
"name": "input"
}
},
"name": "View"
}
},
"position": {
"x": 1017.4149773467798,
"y": -71.64715104646865
},
"height": 644.0,
"parentId": null,
"width": 502.0
},
{
"id": "Build document graph 1",
"type": "basic",
"data": {
"title": "Build document graph",
"params": {},
"display": null,
"error": null,
"collapsed": true,
"meta": {
"name": "Build document graph",
"params": {},
"outputs": {
"output": {
"name": "output",
"position": "right",
"type": {
"type": "None"
}
}
},
"inputs": {
"input": {
"position": "top",
"name": "input",
"type": {
"type": "<class 'inspect._empty'>"
}
}
},
"type": "basic"
}
},
"position": {
"x": -36.39166052931119,
"y": -212.34993098590766
},
"width": 200.0,
"parentId": null,
"height": 80.0
},
{
"id": "Add neighbors 1",
"type": "basic",
"data": {
"title": "Add neighbors",
"params": {},
"display": null,
"error": null,
"meta": {
"type": "basic",
"inputs": {
"nodes": {
"type": {
"type": "<class 'inspect._empty'>"
},
"name": "nodes",
"position": "top"
},
"item": {
"position": "left",
"name": "item",
"type": {
"type": "<class 'inspect._empty'>"
}
},
"edges": {
"name": "edges",
"position": "top",
"type": {
"type": "<class 'inspect._empty'>"
}
}
},
"params": {},
"name": "Add neighbors",
"outputs": {
"output": {
"position": "right",
"name": "output",
"type": {
"type": "None"
}
}
}
},
"collapsed": true
},
"position": {
"x": -2.516468588848724,
"y": 167.64180115746848
},
"parentId": null,
"height": 56.0,
"width": 200.0
},
{
"id": "Predict links 1",
"type": "basic",
"data": {
"title": "Predict links",
"params": {},
"display": null,
"error": null,
"__execution_delay": null,
"meta": {
"name": "Predict links",
"inputs": {
"edges": {
"type": {
"type": "<class 'inspect._empty'>"
},
"name": "edges",
"position": "top"
},
"nodes": {
"name": "nodes",
"position": "top",
"type": {
"type": "<class 'inspect._empty'>"
}
}
},
"type": "basic",
"outputs": {
"output": {
"name": "output",
"type": {
"type": "None"
},
"position": "right"
}
},
"params": {}
},
"collapsed": true
},
"position": {
"x": 34.865308360949726,
"y": -37.44504613652989
},
"height": 200.0,
"width": 200.0,
"parentId": null
}
],
"edges": [
{
"id": "xy-edge__Input document 1output-Split document 1input",
"source": "Input document 1",
"target": "Split document 1",
"sourceHandle": "output",
"targetHandle": "input"
},
{
"id": "xy-edge__Split document 1output-View 1input",
"source": "Split document 1",
"target": "View 1",
"sourceHandle": "output",
"targetHandle": "input"
},
{
"id": "xy-edge__Input chat 1output-RAG 1input",
"source": "Input chat 1",
"target": "RAG 1",
"sourceHandle": "output",
"targetHandle": "input"
},
{
"id": "xy-edge__Split document 1output-RAG 1db",
"source": "Split document 1",
"target": "RAG 1",
"sourceHandle": "output",
"targetHandle": "db"
},
{
"id": "xy-edge__RAG 1output-View 3input",
"source": "RAG 1",
"target": "View 3",
"sourceHandle": "output",
"targetHandle": "input"
},
{
"id": "xy-edge__Create prompt 1output-Ask LLM 1input",
"source": "Create prompt 1",
"target": "Ask LLM 1",
"sourceHandle": "output",
"targetHandle": "input"
},
{
"id": "xy-edge__Ask LLM 1output-View 4input",
"source": "Ask LLM 1",
"target": "View 4",
"sourceHandle": "output",
"targetHandle": "input"
},
{
"id": "xy-edge__RAG 1output-Add neighbors 1item",
"source": "RAG 1",
"target": "Add neighbors 1",
"sourceHandle": "output",
"targetHandle": "item"
},
{
"id": "xy-edge__Add neighbors 1output-Create prompt 1input",
"source": "Add neighbors 1",
"target": "Create prompt 1",
"sourceHandle": "output",
"targetHandle": "input"
},
{
"id": "xy-edge__Split document 1output-Build document graph 1input",
"source": "Split document 1",
"target": "Build document graph 1",
"sourceHandle": "output",
"targetHandle": "input"
},
{
"id": "xy-edge__Split document 1output-Add neighbors 1nodes",
"source": "Split document 1",
"target": "Add neighbors 1",
"sourceHandle": "output",
"targetHandle": "nodes"
},
{
"id": "xy-edge__Split document 1output-Predict links 1nodes",
"source": "Split document 1",
"target": "Predict links 1",
"sourceHandle": "output",
"targetHandle": "nodes"
},
{
"id": "xy-edge__Build document graph 1output-Predict links 1edges",
"source": "Build document graph 1",
"target": "Predict links 1",
"sourceHandle": "output",
"targetHandle": "edges"
},
{
"id": "xy-edge__Predict links 1output-Add neighbors 1edges",
"source": "Predict links 1",
"target": "Add neighbors 1",
"sourceHandle": "output",
"targetHandle": "edges"
}
]
}