(
metadata: Option<serde_json::Value>,
artifact: &ToolOutputArtifact,
)
| 130 | } |
| 131 | |
| 132 | pub(crate) fn merge_tool_output_artifact_metadata( |
| 133 | metadata: Option<serde_json::Value>, |
| 134 | artifact: &ToolOutputArtifact, |
| 135 | ) -> serde_json::Value { |
| 136 | let artifact_json = serde_json::json!({ |
| 137 | "artifact_id": artifact.artifact_id, |
| 138 | "artifact_uri": artifact.artifact_uri, |
| 139 | "original_bytes": artifact.original_bytes, |
| 140 | "shown_bytes": artifact.shown_bytes, |
| 141 | }); |
| 142 | |
| 143 | match metadata { |
| 144 | Some(serde_json::Value::Object(mut object)) => { |
| 145 | object.insert("artifact".to_string(), artifact_json); |
| 146 | serde_json::Value::Object(object) |
| 147 | } |
| 148 | Some(value) => serde_json::json!({ |
| 149 | "artifact": artifact_json, |
| 150 | "previous_metadata": value, |
| 151 | }), |
| 152 | None => serde_json::json!({ |
| 153 | "artifact": artifact_json, |
| 154 | }), |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /// Tool execution result returned by direct tool execution. |
| 159 | #[derive(Debug, Clone, Serialize, Deserialize)] |
no test coverage detected