Skip to content

Commit

Permalink
Change Query Assist sample template to use Claude model (#629)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
dbwiddis authored Mar 29, 2024
1 parent 42f53da commit b86ea9c
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 278 deletions.
Original file line number Diff line number Diff line change
@@ -1,90 +1,109 @@
{
"name": "Query Assist Agent",
"description": "Create a Query Assist Agent using Bedrock and Sagemaker models",
"description": "Create a Query Assist Agent using Claude on BedRock",
"use_case": "REGISTER_AGENT",
"version": {
"template": "1.0.0",
"compatibility": [
"2.12.0",
"3.0.0"
]
"compatibility": ["2.13.0", "3.0.0"]
},
"workflows": {
"provision": {
"user_params": {},
"nodes": [
{
"id": "create_openai_connector",
"id": "create_claude_connector",
"type": "create_connector",
"previous_node_inputs": {},
"user_inputs": {
"name": "OpenAI Chat Connector",
"description": "The connector to public OpenAI model service for GPT 3.5",
"version": "1",
"protocol": "http",
"parameters": {
"endpoint": "api.openai.com",
"model": "gpt-3.5-turbo"
},
"credential": {
"openAI_key": "PUT_YOUR_API_KEY_HERE"
},
"name": "Claude instant runtime Connector",
"protocol": "aws_sigv4",
"description": "The connector to BedRock service for Claude model",
"actions": [
{
"action_type": "predict",
"headers": {
"x-amz-content-sha256": "required",
"content-type": "application/json"
},
"method": "POST",
"url": "https://${parameters.endpoint}/v1/chat/completions"
"request_body": "{\"prompt\":\"${parameters.prompt}\", \"max_tokens_to_sample\":${parameters.max_tokens_to_sample}, \"temperature\":${parameters.temperature}, \"anthropic_version\":\"${parameters.anthropic_version}\" }",
"action_type": "predict",
"url": "https://bedrock-runtime.us-west-2.amazonaws.com/model/anthropic.claude-instant-v1/invoke"
}
]
],
"credential": {
"access_key": "<YOUR_ACCESS_KEY>",
"secret_key": "<YOUR_SECRET_KEY>",
"session_token": "<YOUR_SESSION_TOKEN>"
},
"parameters": {
"region": "us-west-2",
"endpoint": "bedrock-runtime.us-west-2.amazonaws.com",
"content_type": "application/json",
"auth": "Sig_V4",
"max_tokens_to_sample": "8000",
"service_name": "bedrock",
"temperature": "0.0001",
"response_filter": "$.completion",
"anthropic_version": "bedrock-2023-05-31"
}
}
},
{
"id": "register_openai_model",
"id": "register_claude_model",
"type": "register_remote_model",
"previous_node_inputs": {
"create_openai_connector": "connector_id"
"create_claude_connector": "connector_id"
},
"user_inputs": {
"name": "openAI-gpt-3.5-turbo",
"deploy": true
"description": "Claude model",
"deploy": true,
"name": "claude-instant",
"guardrails": {
"type": "local_regex",
"input_guardrail": {
"stop_words": [
{
"index_name": "words0",
"source_fields": ["title"]
}
],
"regex": ["regex1", "regex2"]
},
"output_guardrail": {
"stop_words": [
{
"index_name": "words0",
"source_fields": ["title"]
}
],
"regex": ["regex1", "regex2"]
}
}
}
},
{
"id": "TransferQuestionToPPLAndExecuteTool",
"type": "create_tool",
"previous_node_inputs": {
"register_openai_model": "model_id"
"register_claude_model": "model_id"
},
"user_inputs": {
"type": "PPLTool",
"name": "TransferQuestionToPPLAndExecuteTool",
"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}",
"parameters": {
"response_filter": "$.completion",
"execute": false,
"model_type": "openai"
"execute": false
},
"include_output_in_agent_response": true
}
},
{
"id": "ppl_agent",
"type": "register_agent",
"previous_node_inputs": {
"TransferQuestionToPPLAndExecuteTool": "tools"
},
"user_inputs": {
"parameters": {
},
"app_type": "query_assist",
"name": "PPL agent",
"description": "this is the PPL agent",
"type": "flow"
}
},
{
"id": "summarize_success_tool",
"type": "create_tool",
"previous_node_inputs": {
"register_openai_model": "model_id"
"register_claude_model": "model_id"
},
"user_inputs": {
"type": "MLModelTool",
Expand All @@ -96,26 +115,11 @@
}
}
},
{
"id": "response_summary_agent",
"type": "register_agent",
"previous_node_inputs": {
"summarize_success_tool": "tools"
},
"user_inputs": {
"parameters": {
},
"app_type": "query_assist",
"name": "Response summary agent",
"description": "this is the summarize success PPL response agent",
"type": "flow"
}
},
{
"id": "summarize_error_tool",
"type": "create_tool",
"previous_node_inputs": {
"register_openai_model": "model_id"
"register_claude_model": "model_id"
},
"user_inputs": {
"type": "MLModelTool",
Expand All @@ -132,7 +136,7 @@
"id": "suggestions_tool",
"type": "create_tool",
"previous_node_inputs": {
"register_openai_model": "model_id"
"register_claude_model": "model_id"
},
"user_inputs": {
"type": "MLModelTool",
Expand All @@ -146,97 +150,16 @@
}
},
{
"id": "error_summary_agent",
"id": "ppl_agent",
"type": "register_agent",
"previous_node_inputs": {
"summarize_error_tool": "tools",
"suggestions_tool": "tools"
"TransferQuestionToPPLAndExecuteTool": "tools"
},
"user_inputs": {
"parameters": {
},
"parameters": {},
"app_type": "query_assist",
"name": "Error summary agent",
"description": "this is the agent for summarizing PPL error and give suggested questions",
"tools_order": [
"summarize_error_tool",
"suggestions_tool"
],
"type": "flow"
}
},
{
"id": "ppl_agent_tool",
"type": "create_tool",
"previous_node_inputs": {
"ppl_agent": "agent_id"
},
"user_inputs": {
"description": "PPL Agent Tool",
"include_output_in_agent_response": true,
"type": "AgentTool",
"parameters": {
"max_iteration": "5"
},
"name": "PPLAgentTool"
}
},
{
"id": "response_summary_agent_tool",
"type": "create_tool",
"previous_node_inputs": {
"response_summary_agent": "agent_id"
},
"user_inputs": {
"description": "Response Summary Agent Tool",
"include_output_in_agent_response": true,
"type": "AgentTool",
"parameters": {
"max_iteration": "5"
},
"name": "ResponseSummaryPPLAgentTool"
}
},
{
"id": "error_summary_agent_tool",
"type": "create_tool",
"previous_node_inputs": {
"error_summary_agent": "agent_id"
},
"user_inputs": {
"description": "Error Summary Agent Tool",
"include_output_in_agent_response": true,
"type": "AgentTool",
"parameters": {
"max_iteration": "5"
},
"name": "ErrorSummaryAgentTool"
}
},
{
"id": "root_agent",
"type": "register_agent",
"previous_node_inputs": {
"ppl_agent_tool": "tools",
"response_summary_agent_tool": "tools",
"error_summary_agent_tool": "tools",
"register_openai_model": "model_id"
},
"user_inputs": {
"parameters": {
"prompt": "Answer the question as best you can."
},
"app_type": "chatbot",
"name": "Root agent",
"description": "this is the root agent",
"tools_order": [
"ppl_agent_tool",
"response_summary_agent_tool",
"error_summary_agent_tool"
],
"memory": {
"type": "conversation_index"
},
"name": "PPL agent",
"description": "this is the PPL agent",
"type": "flow"
}
}
Expand Down
Loading

0 comments on commit b86ea9c

Please sign in to comment.