Add Maritime/Logistics support assistant with safety/eval layer
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
//! Turns a Rust type into the JSON Schema object Anthropic expects as a
|
||||
//! tool's `input_schema`.
|
||||
|
||||
use schemars::{schema_for, JsonSchema};
|
||||
use serde_json::Value;
|
||||
|
||||
pub fn schema_value<T: JsonSchema>() -> Value {
|
||||
let mut value = schema_for!(T).as_value().clone();
|
||||
if let Some(object) = value.as_object_mut() {
|
||||
// Anthropic's tool schema validator doesn't need (and can be
|
||||
// confused by) the JSON-Schema-dialect metadata schemars adds.
|
||||
object.remove("$schema");
|
||||
object.remove("title");
|
||||
}
|
||||
value
|
||||
}
|
||||
Reference in New Issue
Block a user