Skip to content

Commit e758c01

Browse files
committed
After testing on AWS SageMaker Studio
1 parent 1b9cdd3 commit e758c01

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

topic/chatbot/table-augmented-generation/aws/cratedb_tag_inline_agent.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
"# --- Configuration ---\n",
233233
"num_machines = 10 # Number of machines to simulate\n",
234234
"days = 30 # Number of days to simulate\n",
235-
"freq_minutes = 10 # Frequency of readings (in minutes)\n",
235+
"freq_minutes = 15 # Frequency of readings (in minutes)\n",
236236
"\n",
237237
"\n",
238238
"# --- Data Generation ---\n",
@@ -548,7 +548,7 @@
548548
"question = \"What was the average rotation for machine 3 the last week?\"\n",
549549
"# question = \"When was the last recorded anomaly?\"\n",
550550
"# question = \"How many readings had a vibration greater than 1.5?\"\n",
551-
"# question = \"What was the number of anomalies per machine in last 48 hours?\"\n",
551+
"# question = \"What was the number of anomalies per machine in the last 48 hours?\"\n",
552552
"\n",
553553
"# Convert to SQL\n",
554554
"sql_query = get_sql_from_llm(question)\n",
@@ -723,7 +723,7 @@
723723
" \"\"\"\n",
724724
" Due to a technicality, we need to translate between two different types of connection URLs.\n",
725725
" pandas was using a SQLAlchemy-style connection URL (crate://...),\n",
726-
" while the MCP server uses an standard HTTP URL with basic auth.\n",
726+
" while the MCP server uses a standard HTTP URL with basic auth.\n",
727727
" \"\"\"\n",
728728
"\n",
729729
" parsed = parse.urlparse(connection_string)\n",
@@ -749,7 +749,7 @@
749749
" server_params=StdioServerParameters(\n",
750750
" # The MCP server is a Python script that we installed earlier as part of `pip install`.\n",
751751
" # It got placed in the `bin` directory of our virtual environment.\n",
752-
" command=f\"{os.environ['VIRTUAL_ENV']}/bin/cratedb-mcp\",\n",
752+
" command=\"cratedb-mcp\",\n",
753753
" args=[\"serve\"],\n",
754754
" env={\n",
755755
" \"CRATEDB_CLUSTER_URL\": sqlalchemy_to_http(CONNECTION_STRING),\n",
@@ -759,7 +759,7 @@
759759
" )\n",
760760
"\n",
761761
" # The action group containing our MCP server.\n",
762-
" # Other type of actions may be OpenAPI schemas or Python methods.\n",
762+
" # Other types of actions may be OpenAPI schemas or Python methods.\n",
763763
" # https://docs.aws.amazon.com/bedrock/latest/userguide/action-define.html\n",
764764
" #\n",
765765
" # We stick to only CrateDB here for the sake of the workshop,\n",
@@ -772,17 +772,17 @@
772772
" return await InlineAgent(\n",
773773
" foundation_model=\"eu.amazon.nova-lite-v1:0\",\n",
774774
" instruction=f\"\"\"\n",
775-
" You are a friendly assistant that receives information from CrateDB.\n",
775+
" You are a friendly assistant who receives information from CrateDB.\n",
776776
" Your task is to translate questions into SQL queries, run them on CrateDB, and return back results.\n",
777777
" Try to generate SQL queries based on the known data model and don't ask questions back.\n",
778778
"\n",
779779
" You have the following tools available:\n",
780780
" 1. `query_sql`: Executes SQL queries on CrateDB\n",
781781
" 2. `get_cratedb_documentation`: Returns the table of contents for the CrateDB documentation. If in doubt about CrateDB-specific syntax, you can obtain the documentation here.\n",
782-
" 3. `fetch_cratedb_docs`: One a specific link within the CrateDB documentation is identified, you can download its content here by providing the link.\n",
782+
" 3. `fetch_cratedb_docs`: Once a specific link within the CrateDB documentation is identified, you can download its content here by providing the link.\n",
783783
" 4. `get_table_metadata`: This returns all metadata for tables in CrateDB.\n",
784784
"\n",
785-
" Try to reason and give an interpretation about the result.\n",
785+
" Try to reason and give an interpretation of the result.\n",
786786
"\n",
787787
" When asked about manuals, query the `manual` column of the `machine_manuals` table to retrieve the manual. Interpret its content to provide an answer.\n",
788788
"\n",
@@ -814,7 +814,7 @@
814814
"# fmt: off\n",
815815
"question = \"Is any of my machines behaving significantly different compared to others? I'm interested in vibration from motor_readings.\"\n",
816816
"# question = \"Did the vibration of machine 4 change between today and yesterday? Query the table motor_readings.\"\n",
817-
"# question = \"How recent is my data in motor_readings? Is there any machine which lacks behind?\"\n",
817+
"# question = \"How recent is my data in motor_readings? Is there any machine that lacks behind?\"\n",
818818
"# question = \"What was the highest temperature ever observed over all machines? Apply DATE_TRUNC to generate a weekly overview and include the week in your reply. The week is returned as a timestamp in millisecond, format it in a human-readable way.\"\n",
819819
"# fmt: on\n",
820820
"\n",
@@ -1017,9 +1017,9 @@
10171017
"outputs": [],
10181018
"source": [
10191019
"# fmt: off\n",
1020-
"question = \"Show me the maintenance steps for machine 5.\"\n",
1020+
"question = \"Show me the maintenance schedule for machine 5. Retrieve the manual column from the machine_manuals table and extract the maintenance schedule from its content.\"\n",
10211021
"# question = \"Is machine 4 overheating?\"\n",
1022-
"# question = \"Give me the max and min vibration observed for machine 6 when rotations > 1600\"\n",
1022+
"# question = \"Give me the max and min vibration observed for machine 6 when rotations > 1600. Rotations are stored in the rotations column.\"\n",
10231023
"# question = \"What should I do if machine 2 has an anomaly?\"\n",
10241024
"# question = \"What can be a reason for higher than usual values for the column vibration in motor_readings for machine 2?\"\n",
10251025
"# question = \"Is machine 5's most recent temperature still ok according to the manual? Look up the most recent temperature from motor_readings.\"\n",

0 commit comments

Comments
 (0)