Skip to content

Commit

Permalink
Fix test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mochi-neko committed Jun 30, 2024
1 parent 8cd7287 commit 42a70b0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ Support [tool use](https://docs.anthropic.com/en/docs/build-with-claude/tool-use

When you define a tool as Rust function with documentation comment like this:

```rust,no_run
```txt
/// Get the current weather in a given location
///
/// ## Arguments
Expand All @@ -321,7 +321,7 @@ fn get_weather(location: String) -> String {

you can use the `clust::clust_macros::clust_tool` attribute macro with `macros` feature flag to generate code:

```rust,no_run
```txt
/// Get the current weather in a given location
///
/// ## Arguments
Expand All @@ -334,19 +334,19 @@ fn get_weather(location: String) -> String {

and create an instance of `clust::messages::Tool` that named by `ClustTool_{function_name}` from the function:

```rust,no_run
```txt
let tool = ClustTool_get_weather {};
```

Get the tool definition from `clust::messages::Tool` for API request:

```rust,no_run
```txt
let tool_definition = tool.definition();
```

and call the tool with tool use got from the API response:

```rust,no_run
```txt
let tool_result = tool.call(tool_use);
```

Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
//!
//! you can use the `clust::clust_macros::clust_tool` attribute macro with `macros` feature flag to generate code:
//!
//! ```rust,no_run
//! ```txt
//! /// Get the current weather in a given location
//! ///
//! /// ## Arguments
Expand All @@ -303,19 +303,19 @@
//!
//! and create an instance of `clust::messages::Tool` that named by `ClustTool_{function_name}` from the function:
//!
//! ```rust,no_run
//! ```txt
//! let tool = ClustTool_get_weather {};
//! ```
//!
//! Get the tool definition from `clust::messages::Tool` for API request:
//!
//! ```rust,no_run
//! ```txt
//! let tool_definition = tool.definition();
//! ```
//!
//! and call the tool with tool use got from the API response:
//!
//! ```rust,no_run
//! ```txt
//! let tool_result = tool.call(tool_use);
//! ```
//!
Expand Down
2 changes: 1 addition & 1 deletion src/messages/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,12 +1700,12 @@ mod tests {

assert_eq!(
Content::from(vec![
ContentBlock::from("text"),
ContentBlock::from(ToolUse::new(
"id",
"name",
serde_json::Value::Object(serde_json::Map::new())
)),
ContentBlock::from("text"),
])
.flatten_into_tool_use()
.unwrap(),
Expand Down

0 comments on commit 42a70b0

Please sign in to comment.