Ignored live check: Ghostlight's own connector port completes plain, tool and schema requests
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
12f4f17ccf
commit
569794fda9
1 changed files with 74 additions and 0 deletions
|
|
@ -7647,6 +7647,80 @@ mod tests {
|
|||
);
|
||||
assert!(schema_within_limits(&oversized).is_err());
|
||||
}
|
||||
|
||||
/// The live check, run by hand on the host that carries claude-connector:
|
||||
/// Ghostlight's own port completes a plain, a tool and an output-schema
|
||||
/// request on haiku and a plain request on sonnet, with usage reported.
|
||||
/// The key reaches the process only as the systemd credential
|
||||
/// `connector-key`, for example
|
||||
/// `systemd-run -p LoadCredential=connector-key:<key file> ...`.
|
||||
#[tokio::test]
|
||||
#[ignore = "needs claude-connector at 127.0.0.1:4110 and its key as the systemd credential connector-key"]
|
||||
async fn live_connector_v4_completes_plain_tool_and_schema_requests() {
|
||||
let key_path = PathBuf::from(
|
||||
std::env::var_os("CREDENTIALS_DIRECTORY").expect("the systemd credential directory"),
|
||||
)
|
||||
.join("connector-key");
|
||||
let port = ConnectorInferencePort::from_secret_file(
|
||||
"127.0.0.1:4110".parse().unwrap(),
|
||||
key_path,
|
||||
"ghostlight",
|
||||
)
|
||||
.expect("the port opens");
|
||||
let stamp = unix_ms().unwrap();
|
||||
let build = |label: &str, model: &str, edit: &dyn Fn(&mut ProviderRequest)| {
|
||||
let mut provider = ProviderRequest::new(
|
||||
format!("live-{label}-{stamp}"),
|
||||
format!("live-{label}-{stamp}-c"),
|
||||
model,
|
||||
"Answer briefly.",
|
||||
300,
|
||||
);
|
||||
provider.input = vec![InputItem::UserText {
|
||||
text: "Say the word ok.".into(),
|
||||
}];
|
||||
provider.reasoning_effort = Some(ReasoningEffort::Low);
|
||||
edit(&mut provider);
|
||||
InferenceRequest {
|
||||
purpose: InferencePurpose::Persona,
|
||||
provider,
|
||||
}
|
||||
};
|
||||
let tool = |provider: &mut ProviderRequest| {
|
||||
provider.tools = vec![ToolDefinition {
|
||||
name: "note".into(),
|
||||
description: "Record a note.".into(),
|
||||
parameters_json:
|
||||
r#"{"type":"object","additionalProperties":false,"required":["text"],"properties":{"text":{"type":"string"}}}"#
|
||||
.into(),
|
||||
}];
|
||||
provider.input = vec![InputItem::UserText {
|
||||
text: "Call the note tool with text ok.".into(),
|
||||
}];
|
||||
};
|
||||
let schema = |provider: &mut ProviderRequest| {
|
||||
provider.output_schema_json = Some(
|
||||
r#"{"type":"object","additionalProperties":false,"required":["ok"],"properties":{"ok":{"type":"boolean"}}}"#
|
||||
.into(),
|
||||
);
|
||||
};
|
||||
let cases = [
|
||||
build("plain", "claude-haiku-5-5", &|_| {}),
|
||||
build("tool", "claude-haiku-5-5", &tool),
|
||||
build("schema", "claude-haiku-5-5", &schema),
|
||||
build("sonnet", "claude-sonnet-5-5", &|_| {}),
|
||||
];
|
||||
for (label, request) in ["plain", "tool", "schema", "sonnet"].into_iter().zip(cases) {
|
||||
let prepared = port.prepare(request).expect("the request prepares");
|
||||
let output = port.infer(prepared).await.unwrap_or_else(|fault| {
|
||||
panic!("{label}: the connector faulted: {fault:?}");
|
||||
});
|
||||
let usage = output.usage.expect("the connector reports usage");
|
||||
assert!(usage.prompt > 0 && usage.completion > 0, "{label}: {usage:?}");
|
||||
assert!(!output.events.is_empty(), "{label}: no events");
|
||||
eprintln!("live {label}: {usage:?}, {} events", output.events.len());
|
||||
}
|
||||
}
|
||||
use super::*;
|
||||
use crate::elaboration::{ElaboratorSession, EvidenceError, EvidenceQuery, EvidenceReceipt};
|
||||
use crate::tests::{operations, opportunity_for};
|
||||
|
|
|
|||
Loading…
Reference in a new issue