pub enum Action {
Read {
path: String,
},
List {
path: String,
},
Search {
pattern: String,
path: String,
},
Edit {
path: String,
old_text: String,
new_text: String,
},
Run {
command: String,
},
}Expand description
One action the model asked for.
Variants§
Read
Read a text file.
List
List a folder; an empty path or . is the root.
Search
Find a piece of text in the files under a folder.
Fields
Edit
Replace one exact piece of text in a file, or create a new file.
Fields
Run
Run a shell command in the workspace root.
Implementations§
Source§impl Action
impl Action
Sourcepub fn definitions() -> Value
pub fn definitions() -> Value
The five tools in Anthropic tool-use form: the JSON array for the request’s tools field,
each with a name, a description and an input_schema.
Sourcepub fn from_call(name: &str, input: &Value) -> Result<Self, String>
pub fn from_call(name: &str, input: &Value) -> Result<Self, String>
Reads a tool call. An unknown tool or a bad input gives a sentence for the model.
§Errors
When name is not one of the five tools, or input is not an object with the fields the
tool needs as strings.
Sourcepub fn needs_approval(&self) -> bool
pub fn needs_approval(&self) -> bool
Whether the person must approve the action first: editing and running do, reading does not.
Sourcepub fn kind(&self) -> ActionKind
pub fn kind(&self) -> ActionKind
Which action this is.
Sourcepub fn subject(&self) -> &str
pub fn subject(&self) -> &str
What the action is about: the path for reading, listing and editing, the pattern for a search and the command for running.
Sourcepub fn summary(&self) -> String
pub fn summary(&self) -> String
One short untranslated line for the transcript, such as read src/main.rs or
run cargo test. An application that translates builds its own line from Self::kind
and Self::subject.
Trait Implementations§
impl Eq for Action
impl StructuralPartialEq for Action
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnsafeUnpin for Action
impl UnwindSafe for Action
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more