dave: add a few tool docs
So that readers of this code can actually figure out what these types actually mean. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
/// A tool
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct ToolCall {
|
pub struct ToolCall {
|
||||||
id: String,
|
id: String,
|
||||||
@@ -29,6 +30,9 @@ impl ToolCall {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// On streaming APIs, tool calls are incremental. We use this
|
||||||
|
/// to represent tool calls that are in the process of returning.
|
||||||
|
/// These eventually just become [`ToolCall`]'s
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Default, Debug, Clone)]
|
||||||
pub struct PartialToolCall {
|
pub struct PartialToolCall {
|
||||||
id: Option<String>,
|
id: Option<String>,
|
||||||
@@ -97,6 +101,10 @@ impl PartialToolCall {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An enumeration of the possible tool calls that
|
||||||
|
/// can be parsed from Dave responses. When adding
|
||||||
|
/// new tools, this needs to be updated so that we can
|
||||||
|
/// handle tool call responses.
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum ToolCalls {
|
pub enum ToolCalls {
|
||||||
Query(QueryCall),
|
Query(QueryCall),
|
||||||
@@ -271,7 +279,7 @@ pub enum QueryContext {
|
|||||||
Any,
|
Any,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The parsed query that dave wants to use to satisfy a request
|
/// The parsed nostrdb query that dave wants to use to satisfy a request
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
pub struct QueryCall {
|
pub struct QueryCall {
|
||||||
context: Option<QueryContext>,
|
context: Option<QueryContext>,
|
||||||
|
|||||||
Reference in New Issue
Block a user