Skip to content

Commit

Permalink
feat: make client Debug-able
Browse files Browse the repository at this point in the history
This is useful if you want to include client::Client in your own
implementation and derive Debug.
  • Loading branch information
fgsch committed Jul 10, 2024
1 parent 0c097aa commit c2cf1c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/v1/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::{

use crate::v1::{chat, chat_stream, constants, embedding, error, model_list, tool, utils};

#[derive(Debug)]
pub struct Client {
pub api_key: String,
pub endpoint: String,
Expand Down
8 changes: 7 additions & 1 deletion src/v1/tool.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use std::{any::Any, collections::HashMap};
use std::{any::Any, collections::HashMap, fmt::Debug};

// -----------------------------------------------------------------------------
// Definitions
Expand Down Expand Up @@ -136,3 +136,9 @@ pub enum ToolChoice {
pub trait Function {
async fn execute(&self, arguments: String) -> Box<dyn Any + Send>;
}

impl Debug for dyn Function {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Function()")
}
}

0 comments on commit c2cf1c6

Please sign in to comment.