File tree Expand file tree Collapse file tree 5 files changed +6
-7
lines changed Expand file tree Collapse file tree 5 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -485,7 +485,7 @@ where
485
485
if message. data == "[DONE]" {
486
486
break ;
487
487
}
488
-
488
+ println ! ( "message: {:?}" , message . data ) ;
489
489
let response = match serde_json:: from_str :: < O > ( & message. data ) {
490
490
Err ( e) => Err ( map_deserialization_error ( e, message. data . as_bytes ( ) ) ) ,
491
491
Ok ( output) => Ok ( output) ,
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ mod projects;
149
149
mod runs;
150
150
mod steps;
151
151
mod threads;
152
- mod tools;
152
+ pub mod tools;
153
153
pub mod traits;
154
154
pub mod types;
155
155
mod uploads;
@@ -181,7 +181,6 @@ pub use projects::Projects;
181
181
pub use runs:: Runs ;
182
182
pub use steps:: Steps ;
183
183
pub use threads:: Threads ;
184
- pub use tools:: { Tool , ToolManager , ToolCallStreamManager } ;
185
184
pub use uploads:: Uploads ;
186
185
pub use users:: Users ;
187
186
pub use vector_store_file_batches:: VectorStoreFileBatches ;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ pub trait Tool: Send + Sync {
65
65
66
66
/// A dynamic trait for tools that allows for runtime tool management.
67
67
/// This trait provides a way to work with tools without knowing their concrete types at compile time.
68
- trait ToolDyn : Send + Sync {
68
+ pub trait ToolDyn : Send + Sync {
69
69
/// Returns the tool's definition as a ChatCompletionTool.
70
70
fn definition ( & self ) -> ChatCompletionTool ;
71
71
Original file line number Diff line number Diff line change 1
1
use std:: error:: Error ;
2
2
use std:: io:: { stdout, Write } ;
3
3
4
+ use async_openai:: tools:: { Tool , ToolCallStreamManager , ToolManager } ;
4
5
use async_openai:: types:: {
5
6
ChatCompletionRequestAssistantMessageArgs , ChatCompletionRequestMessage ,
6
7
ChatCompletionRequestUserMessageArgs , FinishReason ,
7
8
} ;
8
9
use async_openai:: { types:: CreateChatCompletionRequestArgs , Client } ;
9
- use async_openai:: { Tool , ToolCallStreamManager , ToolManager } ;
10
10
use futures:: StreamExt ;
11
11
use rand:: seq:: SliceRandom ;
12
12
use rand:: { thread_rng, Rng } ;
@@ -67,7 +67,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
67
67
}
68
68
69
69
if !is_end_with_tool_call {
70
- return Err ( "The response is not ended with tool call" . into ( ) ) ;
70
+ println ! ( "The response is not ended with tool call" ) ;
71
71
}
72
72
let tool_calls = tool_call_stream_manager. finish_stream ( ) ;
73
73
let function_responses = tool_manager. call ( tool_calls. clone ( ) ) . await ;
Original file line number Diff line number Diff line change 1
1
use std:: io:: { stdout, Write } ;
2
2
3
+ use async_openai:: tools:: { Tool , ToolManager } ;
3
4
use async_openai:: types:: {
4
5
ChatCompletionRequestAssistantMessageArgs , ChatCompletionRequestMessage ,
5
6
ChatCompletionRequestUserMessageArgs ,
6
7
} ;
7
8
use async_openai:: { types:: CreateChatCompletionRequestArgs , Client } ;
8
- use async_openai:: { Tool , ToolManager } ;
9
9
use futures:: StreamExt ;
10
10
use rand:: seq:: SliceRandom ;
11
11
use rand:: { thread_rng, Rng } ;
You can’t perform that action at this time.
0 commit comments