Skip to content

Commit b86ea9c

Browse files
authored
Change Query Assist sample template to use Claude model (#629)
* Change Query Assist sample template to use Claude model Signed-off-by: Daniel Widdis <[email protected]> * Add guardrail type Signed-off-by: Daniel Widdis <[email protected]> * Add session_token Signed-off-by: Daniel Widdis <[email protected]> * Rename model files to identify LLM and testing status Signed-off-by: Daniel Widdis <[email protected]> --------- Signed-off-by: Daniel Widdis <[email protected]>
1 parent 42f53da commit b86ea9c

4 files changed

+150
-278
lines changed

sample-templates/query-assist-agent.json sample-templates/query-assist-agent-claude-tested.json

+68-145
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,109 @@
11
{
22
"name": "Query Assist Agent",
3-
"description": "Create a Query Assist Agent using Bedrock and Sagemaker models",
3+
"description": "Create a Query Assist Agent using Claude on BedRock",
44
"use_case": "REGISTER_AGENT",
55
"version": {
66
"template": "1.0.0",
7-
"compatibility": [
8-
"2.12.0",
9-
"3.0.0"
10-
]
7+
"compatibility": ["2.13.0", "3.0.0"]
118
},
129
"workflows": {
1310
"provision": {
11+
"user_params": {},
1412
"nodes": [
1513
{
16-
"id": "create_openai_connector",
14+
"id": "create_claude_connector",
1715
"type": "create_connector",
16+
"previous_node_inputs": {},
1817
"user_inputs": {
19-
"name": "OpenAI Chat Connector",
20-
"description": "The connector to public OpenAI model service for GPT 3.5",
2118
"version": "1",
22-
"protocol": "http",
23-
"parameters": {
24-
"endpoint": "api.openai.com",
25-
"model": "gpt-3.5-turbo"
26-
},
27-
"credential": {
28-
"openAI_key": "PUT_YOUR_API_KEY_HERE"
29-
},
19+
"name": "Claude instant runtime Connector",
20+
"protocol": "aws_sigv4",
21+
"description": "The connector to BedRock service for Claude model",
3022
"actions": [
3123
{
32-
"action_type": "predict",
24+
"headers": {
25+
"x-amz-content-sha256": "required",
26+
"content-type": "application/json"
27+
},
3328
"method": "POST",
34-
"url": "https://${parameters.endpoint}/v1/chat/completions"
29+
"request_body": "{\"prompt\":\"${parameters.prompt}\", \"max_tokens_to_sample\":${parameters.max_tokens_to_sample}, \"temperature\":${parameters.temperature}, \"anthropic_version\":\"${parameters.anthropic_version}\" }",
30+
"action_type": "predict",
31+
"url": "https://bedrock-runtime.us-west-2.amazonaws.com/model/anthropic.claude-instant-v1/invoke"
3532
}
36-
]
33+
],
34+
"credential": {
35+
"access_key": "<YOUR_ACCESS_KEY>",
36+
"secret_key": "<YOUR_SECRET_KEY>",
37+
"session_token": "<YOUR_SESSION_TOKEN>"
38+
},
39+
"parameters": {
40+
"region": "us-west-2",
41+
"endpoint": "bedrock-runtime.us-west-2.amazonaws.com",
42+
"content_type": "application/json",
43+
"auth": "Sig_V4",
44+
"max_tokens_to_sample": "8000",
45+
"service_name": "bedrock",
46+
"temperature": "0.0001",
47+
"response_filter": "$.completion",
48+
"anthropic_version": "bedrock-2023-05-31"
49+
}
3750
}
3851
},
3952
{
40-
"id": "register_openai_model",
53+
"id": "register_claude_model",
4154
"type": "register_remote_model",
4255
"previous_node_inputs": {
43-
"create_openai_connector": "connector_id"
56+
"create_claude_connector": "connector_id"
4457
},
4558
"user_inputs": {
46-
"name": "openAI-gpt-3.5-turbo",
47-
"deploy": true
59+
"description": "Claude model",
60+
"deploy": true,
61+
"name": "claude-instant",
62+
"guardrails": {
63+
"type": "local_regex",
64+
"input_guardrail": {
65+
"stop_words": [
66+
{
67+
"index_name": "words0",
68+
"source_fields": ["title"]
69+
}
70+
],
71+
"regex": ["regex1", "regex2"]
72+
},
73+
"output_guardrail": {
74+
"stop_words": [
75+
{
76+
"index_name": "words0",
77+
"source_fields": ["title"]
78+
}
79+
],
80+
"regex": ["regex1", "regex2"]
81+
}
82+
}
4883
}
4984
},
5085
{
5186
"id": "TransferQuestionToPPLAndExecuteTool",
5287
"type": "create_tool",
5388
"previous_node_inputs": {
54-
"register_openai_model": "model_id"
89+
"register_claude_model": "model_id"
5590
},
5691
"user_inputs": {
5792
"type": "PPLTool",
5893
"name": "TransferQuestionToPPLAndExecuteTool",
5994
"description": "Use this tool to transfer natural language to generate PPL and execute PPL to query inside. Use this tool after you know the index name, otherwise, call IndexRoutingTool first. The input parameters are: {index:IndexName, question:UserQuestion}",
6095
"parameters": {
6196
"response_filter": "$.completion",
62-
"execute": false,
63-
"model_type": "openai"
97+
"execute": false
6498
},
6599
"include_output_in_agent_response": true
66100
}
67101
},
68-
{
69-
"id": "ppl_agent",
70-
"type": "register_agent",
71-
"previous_node_inputs": {
72-
"TransferQuestionToPPLAndExecuteTool": "tools"
73-
},
74-
"user_inputs": {
75-
"parameters": {
76-
},
77-
"app_type": "query_assist",
78-
"name": "PPL agent",
79-
"description": "this is the PPL agent",
80-
"type": "flow"
81-
}
82-
},
83102
{
84103
"id": "summarize_success_tool",
85104
"type": "create_tool",
86105
"previous_node_inputs": {
87-
"register_openai_model": "model_id"
106+
"register_claude_model": "model_id"
88107
},
89108
"user_inputs": {
90109
"type": "MLModelTool",
@@ -96,26 +115,11 @@
96115
}
97116
}
98117
},
99-
{
100-
"id": "response_summary_agent",
101-
"type": "register_agent",
102-
"previous_node_inputs": {
103-
"summarize_success_tool": "tools"
104-
},
105-
"user_inputs": {
106-
"parameters": {
107-
},
108-
"app_type": "query_assist",
109-
"name": "Response summary agent",
110-
"description": "this is the summarize success PPL response agent",
111-
"type": "flow"
112-
}
113-
},
114118
{
115119
"id": "summarize_error_tool",
116120
"type": "create_tool",
117121
"previous_node_inputs": {
118-
"register_openai_model": "model_id"
122+
"register_claude_model": "model_id"
119123
},
120124
"user_inputs": {
121125
"type": "MLModelTool",
@@ -132,7 +136,7 @@
132136
"id": "suggestions_tool",
133137
"type": "create_tool",
134138
"previous_node_inputs": {
135-
"register_openai_model": "model_id"
139+
"register_claude_model": "model_id"
136140
},
137141
"user_inputs": {
138142
"type": "MLModelTool",
@@ -146,97 +150,16 @@
146150
}
147151
},
148152
{
149-
"id": "error_summary_agent",
153+
"id": "ppl_agent",
150154
"type": "register_agent",
151155
"previous_node_inputs": {
152-
"summarize_error_tool": "tools",
153-
"suggestions_tool": "tools"
156+
"TransferQuestionToPPLAndExecuteTool": "tools"
154157
},
155158
"user_inputs": {
156-
"parameters": {
157-
},
159+
"parameters": {},
158160
"app_type": "query_assist",
159-
"name": "Error summary agent",
160-
"description": "this is the agent for summarizing PPL error and give suggested questions",
161-
"tools_order": [
162-
"summarize_error_tool",
163-
"suggestions_tool"
164-
],
165-
"type": "flow"
166-
}
167-
},
168-
{
169-
"id": "ppl_agent_tool",
170-
"type": "create_tool",
171-
"previous_node_inputs": {
172-
"ppl_agent": "agent_id"
173-
},
174-
"user_inputs": {
175-
"description": "PPL Agent Tool",
176-
"include_output_in_agent_response": true,
177-
"type": "AgentTool",
178-
"parameters": {
179-
"max_iteration": "5"
180-
},
181-
"name": "PPLAgentTool"
182-
}
183-
},
184-
{
185-
"id": "response_summary_agent_tool",
186-
"type": "create_tool",
187-
"previous_node_inputs": {
188-
"response_summary_agent": "agent_id"
189-
},
190-
"user_inputs": {
191-
"description": "Response Summary Agent Tool",
192-
"include_output_in_agent_response": true,
193-
"type": "AgentTool",
194-
"parameters": {
195-
"max_iteration": "5"
196-
},
197-
"name": "ResponseSummaryPPLAgentTool"
198-
}
199-
},
200-
{
201-
"id": "error_summary_agent_tool",
202-
"type": "create_tool",
203-
"previous_node_inputs": {
204-
"error_summary_agent": "agent_id"
205-
},
206-
"user_inputs": {
207-
"description": "Error Summary Agent Tool",
208-
"include_output_in_agent_response": true,
209-
"type": "AgentTool",
210-
"parameters": {
211-
"max_iteration": "5"
212-
},
213-
"name": "ErrorSummaryAgentTool"
214-
}
215-
},
216-
{
217-
"id": "root_agent",
218-
"type": "register_agent",
219-
"previous_node_inputs": {
220-
"ppl_agent_tool": "tools",
221-
"response_summary_agent_tool": "tools",
222-
"error_summary_agent_tool": "tools",
223-
"register_openai_model": "model_id"
224-
},
225-
"user_inputs": {
226-
"parameters": {
227-
"prompt": "Answer the question as best you can."
228-
},
229-
"app_type": "chatbot",
230-
"name": "Root agent",
231-
"description": "this is the root agent",
232-
"tools_order": [
233-
"ppl_agent_tool",
234-
"response_summary_agent_tool",
235-
"error_summary_agent_tool"
236-
],
237-
"memory": {
238-
"type": "conversation_index"
239-
},
161+
"name": "PPL agent",
162+
"description": "this is the PPL agent",
240163
"type": "flow"
241164
}
242165
}

0 commit comments

Comments
 (0)