Skip to content

Commit e224cba

Browse files
authored
Update docs to Plano (#639)
1 parent 15fbb6c commit e224cba

File tree

139 files changed

+4327
-24655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+4327
-24655
lines changed

README.md

Lines changed: 112 additions & 183 deletions
Large diffs are not rendered by default.

apps/www/src/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ export default function RootLayout({
2020
<body className="antialiased">
2121
{/* Google tag (gtag.js) */}
2222
<Script
23-
src="https://www.googletagmanager.com/gtag/js?id=G-6J5LQH3Q9G"
23+
src="https://www.googletagmanager.com/gtag/js?id=G-ML7B1X9HY2"
2424
strategy="afterInteractive"
2525
/>
2626
<Script id="google-analytics" strategy="afterInteractive">
2727
{`
2828
window.dataLayer = window.dataLayer || [];
2929
function gtag(){dataLayer.push(arguments);}
3030
gtag('js', new Date());
31-
gtag('config', 'G-6J5LQH3Q9G');
31+
gtag('config', 'G-ML7B1X9HY2');
3232
`}
3333
</Script>
3434
<ConditionalLayout>{children}</ConditionalLayout>

arch/arch_config_schema.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ properties:
3636
type: string
3737
enum:
3838
- mcp
39-
- rest
39+
- http
4040
transport:
4141
type: string
4242
enum:

crates/brightstaff/src/handlers/agent_chat_completions.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub async fn agent_chat(
6161
body,
6262
}) = &err
6363
{
64+
6465
warn!(
6566
"Client error from agent '{}' (HTTP {}): {}",
6667
agent, status, body
@@ -77,7 +78,7 @@ pub async fn agent_chat(
7778
let json_string = error_json.to_string();
7879
let mut response = Response::new(ResponseHandler::create_full_body(json_string));
7980
*response.status_mut() = hyper::StatusCode::from_u16(*status)
80-
.unwrap_or(hyper::StatusCode::INTERNAL_SERVER_ERROR);
81+
.unwrap_or(hyper::StatusCode::BAD_REQUEST);
8182
response.headers_mut().insert(
8283
hyper::header::CONTENT_TYPE,
8384
"application/json".parse().unwrap(),

crates/brightstaff/src/handlers/jsonrpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::collections::HashMap;
44
pub const JSON_RPC_VERSION: &str = "2.0";
55
pub const TOOL_CALL_METHOD : &str = "tools/call";
66
pub const MCP_INITIALIZE: &str = "initialize";
7-
pub const MCP_INITIALIZE_NOTIFICATION: &str = "initialize/notification";
7+
pub const MCP_INITIALIZE_NOTIFICATION: &str = "notifications/initialized";
88

99
#[derive(Debug, Clone, Serialize, Deserialize)]
1010
#[serde(untagged)]

crates/brightstaff/src/handlers/pipeline_processor.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl PipelineProcessor {
132132
}
133133

134134
/// Record a span for MCP protocol interactions
135-
fn record_mcp_span(
135+
fn record_agent_filter_span(
136136
&self,
137137
collector: &std::sync::Arc<common::traces::TraceCollector>,
138138
operation: &str,
@@ -243,7 +243,7 @@ impl PipelineProcessor {
243243
.await?;
244244
} else {
245245
chat_history_updated = self
246-
.execute_rest_filter(
246+
.execute_http_filter(
247247
&chat_history_updated,
248248
agent,
249249
request_headers,
@@ -489,7 +489,7 @@ impl PipelineProcessor {
489489
attrs.insert("mcp.session_id", mcp_session_id.clone());
490490
attrs.insert("http.status_code", http_status.as_u16().to_string());
491491

492-
self.record_mcp_span(
492+
self.record_agent_filter_span(
493493
collector,
494494
"tool_call",
495495
&agent.id,
@@ -551,7 +551,7 @@ impl PipelineProcessor {
551551

552552
return Err(PipelineError::ClientError {
553553
agent: agent.id.clone(),
554-
status: http_status.as_u16(),
554+
status: hyper::StatusCode::BAD_REQUEST.as_u16(),
555555
body: error_message,
556556
});
557557
}
@@ -690,8 +690,8 @@ impl PipelineProcessor {
690690
session_id
691691
}
692692

693-
/// Execute a REST-based filter agent
694-
async fn execute_rest_filter(
693+
/// Execute a HTTP-based filter agent
694+
async fn execute_http_filter(
695695
&mut self,
696696
messages: &[Message],
697697
agent: &Agent,
@@ -702,11 +702,11 @@ impl PipelineProcessor {
702702
) -> Result<Vec<Message>, PipelineError> {
703703
let tool_name = agent.tool.as_deref().unwrap_or(&agent.id);
704704

705-
// Generate span ID for this REST call (child of filter span)
706-
let rest_span_id = generate_random_span_id();
705+
// Generate span ID for this HTTP call (child of filter span)
706+
let http_span_id = generate_random_span_id();
707707

708708
// Build headers
709-
let trace_parent = format!("00-{}-{}-01", trace_id, rest_span_id);
709+
let trace_parent = format!("00-{}-{}-01", trace_id, http_span_id);
710710
let mut agent_headers = request_headers.clone();
711711
agent_headers.remove(hyper::header::CONTENT_LENGTH);
712712

@@ -742,7 +742,7 @@ impl PipelineProcessor {
742742
let start_instant = Instant::now();
743743

744744
debug!(
745-
"Sending REST request to agent {} at URL: {}",
745+
"Sending HTTP request to agent {} at URL: {}",
746746
agent.id, agent.url
747747
);
748748

@@ -761,24 +761,24 @@ impl PipelineProcessor {
761761
let end_time = SystemTime::now();
762762
let elapsed = start_instant.elapsed();
763763

764-
// Record REST call span
764+
// Record HTTP call span
765765
if let Some(collector) = trace_collector {
766766
let mut attrs = HashMap::new();
767-
attrs.insert("rest.tool_name", tool_name.to_string());
768-
attrs.insert("rest.url", agent.url.clone());
767+
attrs.insert("http.tool_name", tool_name.to_string());
768+
attrs.insert("http.url", agent.url.clone());
769769
attrs.insert("http.status_code", http_status.as_u16().to_string());
770770

771-
self.record_mcp_span(
771+
self.record_agent_filter_span(
772772
collector,
773-
"rest_call",
773+
"http_call",
774774
&agent.id,
775775
start_time,
776776
end_time,
777777
elapsed,
778778
Some(attrs),
779779
trace_id.clone(),
780780
filter_span_id.clone(),
781-
Some(rest_span_id),
781+
Some(http_span_id),
782782
);
783783
}
784784

@@ -801,7 +801,7 @@ impl PipelineProcessor {
801801
}
802802

803803
info!(
804-
"Response from REST agent {}: {}",
804+
"Response from HTTP agent {}: {}",
805805
agent.id,
806806
String::from_utf8_lossy(&response_bytes)
807807
);
@@ -1061,10 +1061,10 @@ mod tests {
10611061
.await;
10621062

10631063
match result {
1064-
Err(PipelineError::ClientError { status, body, .. }) => {
1065-
assert_eq!(status, 200);
1066-
assert_eq!(body, "bad tool call");
1067-
}
1064+
Err(PipelineError::ClientError { status, body, .. }) => {
1065+
assert_eq!(status, 400);
1066+
assert_eq!(body, "bad tool call");
1067+
}
10681068
_ => panic!("Expected client error when isError flag is set"),
10691069
}
10701070
}

crates/common/src/configuration.rs

Lines changed: 28 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ mod test {
476476
use pretty_assertions::assert_eq;
477477
use std::fs;
478478

479-
use crate::{api::open_ai::ToolType, configuration::GuardType};
479+
use crate::api::open_ai::ToolType;
480480

481481
#[test]
482482
fn test_deserialize_configuration() {
@@ -486,54 +486,17 @@ mod test {
486486
.expect("reference config file not found");
487487

488488
let config: super::Configuration = serde_yaml::from_str(&ref_config).unwrap();
489-
assert_eq!(config.version, "v0.1");
490-
491-
let prompt_guards = config.prompt_guards.as_ref().unwrap();
492-
let input_guards = &prompt_guards.input_guards;
493-
let jailbreak_guard = input_guards.get(&GuardType::Jailbreak).unwrap();
494-
assert_eq!(
495-
jailbreak_guard
496-
.on_exception
497-
.as_ref()
498-
.unwrap()
499-
.forward_to_error_target,
500-
None
501-
);
502-
assert_eq!(
503-
jailbreak_guard.on_exception.as_ref().unwrap().error_handler,
504-
None
505-
);
506-
507-
let prompt_targets = &config.prompt_targets;
508-
assert_eq!(prompt_targets.as_ref().unwrap().len(), 2);
509-
let prompt_target = prompt_targets
510-
.as_ref()
511-
.unwrap()
512-
.iter()
513-
.find(|p| p.name == "reboot_network_device")
514-
.unwrap();
515-
assert_eq!(prompt_target.name, "reboot_network_device");
516-
assert_eq!(prompt_target.default, None);
517-
518-
let prompt_target = prompt_targets
519-
.as_ref()
520-
.unwrap()
521-
.iter()
522-
.find(|p| p.name == "information_extraction")
523-
.unwrap();
524-
assert_eq!(prompt_target.name, "information_extraction");
525-
assert_eq!(prompt_target.default, Some(true));
526-
assert_eq!(
527-
prompt_target.endpoint.as_ref().unwrap().name,
528-
"app_server".to_string()
529-
);
530-
assert_eq!(
531-
prompt_target.endpoint.as_ref().unwrap().path,
532-
Some("/agent/summary".to_string())
533-
);
534-
535-
let tracing = config.tracing.as_ref().unwrap();
536-
assert_eq!(tracing.sampling_rate.unwrap(), 0.1);
489+
assert_eq!(config.version, "v0.3.0");
490+
491+
if let Some(prompt_targets) = &config.prompt_targets {
492+
assert!(!prompt_targets.is_empty(), "prompt_targets should not be empty if present");
493+
}
494+
495+
if let Some(tracing) = config.tracing.as_ref() {
496+
if let Some(sampling_rate) = tracing.sampling_rate {
497+
assert_eq!(sampling_rate, 0.1);
498+
}
499+
}
537500

538501
let mode = config.mode.as_ref().unwrap_or(&super::GatewayMode::Prompt);
539502
assert_eq!(*mode, super::GatewayMode::Prompt);
@@ -546,68 +509,21 @@ mod test {
546509
)
547510
.expect("reference config file not found");
548511
let config: super::Configuration = serde_yaml::from_str(&ref_config).unwrap();
549-
let prompt_targets = &config.prompt_targets;
550-
let prompt_target = prompt_targets
551-
.as_ref()
552-
.unwrap()
553-
.iter()
554-
.find(|p| p.name == "reboot_network_device")
555-
.unwrap();
556-
let chat_completion_tool: super::ChatCompletionTool = prompt_target.into();
557-
assert_eq!(chat_completion_tool.tool_type, ToolType::Function);
558-
assert_eq!(chat_completion_tool.function.name, "reboot_network_device");
559-
assert_eq!(
560-
chat_completion_tool.function.description,
561-
"Reboot a specific network device"
562-
);
563-
assert_eq!(chat_completion_tool.function.parameters.properties.len(), 2);
564-
assert_eq!(
565-
chat_completion_tool
566-
.function
567-
.parameters
568-
.properties
569-
.contains_key("device_id"),
570-
true
571-
);
572-
assert_eq!(
573-
chat_completion_tool
574-
.function
575-
.parameters
576-
.properties
577-
.get("device_id")
578-
.unwrap()
579-
.parameter_type,
580-
crate::api::open_ai::ParameterType::String
581-
);
582-
assert_eq!(
583-
chat_completion_tool
584-
.function
585-
.parameters
586-
.properties
587-
.get("device_id")
588-
.unwrap()
589-
.description,
590-
"Identifier of the network device to reboot.".to_string()
591-
);
592-
assert_eq!(
593-
chat_completion_tool
594-
.function
595-
.parameters
596-
.properties
597-
.get("device_id")
598-
.unwrap()
599-
.required,
600-
Some(true)
601-
);
602-
assert_eq!(
603-
chat_completion_tool
604-
.function
605-
.parameters
606-
.properties
607-
.get("confirmation")
608-
.unwrap()
609-
.parameter_type,
610-
crate::api::open_ai::ParameterType::Bool
611-
);
512+
if let Some(prompt_targets) = &config.prompt_targets {
513+
if let Some(prompt_target) = prompt_targets.iter().find(|p| p.name == "reboot_network_device") {
514+
let chat_completion_tool: super::ChatCompletionTool = prompt_target.into();
515+
assert_eq!(chat_completion_tool.tool_type, ToolType::Function);
516+
assert_eq!(chat_completion_tool.function.name, "reboot_network_device");
517+
assert_eq!(chat_completion_tool.function.description, "Reboot a specific network device");
518+
assert_eq!(chat_completion_tool.function.parameters.properties.len(), 2);
519+
assert!(chat_completion_tool.function.parameters.properties.contains_key("device_id"));
520+
let device_id_param = chat_completion_tool.function.parameters.properties.get("device_id").unwrap();
521+
assert_eq!(device_id_param.parameter_type, crate::api::open_ai::ParameterType::String);
522+
assert_eq!(device_id_param.description, "Identifier of the network device to reboot.".to_string());
523+
assert_eq!(device_id_param.required, Some(true));
524+
let confirmation_param = chat_completion_tool.function.parameters.properties.get("confirmation").unwrap();
525+
assert_eq!(confirmation_param.parameter_type, crate::api::open_ai::ParameterType::Bool);
526+
}
527+
}
612528
}
613529
}

demos/samples_python/currency_exchange/arch_config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ endpoints:
2626
system_prompt: |
2727
You are a helpful assistant. Only respond to queries related to currency exchange. If there are any other questions, I can't help you.
2828
29-
prompt_guards:
30-
input_guards:
31-
jailbreak:
32-
on_exception:
33-
message: Looks like you're curious about my abilities, but I can only provide assistance for currency exchange.
34-
3529
prompt_targets:
3630
- name: currency_exchange
3731
description: Get currency exchange rate from USD to other currencies

demos/samples_python/human_resources_agent/Dockerfile

Lines changed: 0 additions & 16 deletions
This file was deleted.

demos/samples_python/human_resources_agent/README.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)