Commit 381d2d2 1 parent d40e018 commit 381d2d2 Copy full SHA for 381d2d2
File tree 3 files changed +14
-13
lines changed
3 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 5
5
- ' goal'
6
6
7
7
system_prompt : >
8
- You are an useful assistant that executes any task the user provides.
9
-
10
-
8
+ You are an useful assistant that executes any task the user provides.
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ impl Client for OllamaClient {
166
166
}
167
167
}
168
168
169
- log:: debug !( "ollama.tools={:?}" , & tools) ;
169
+ log:: trace !( "ollama.tools={:?}" , & tools) ;
170
170
}
171
171
172
172
let mut request = ChatMessageRequest :: new ( self . model . to_string ( ) , chat_history)
@@ -185,6 +185,8 @@ impl Client for OllamaClient {
185
185
let mut invocations = vec ! [ ] ;
186
186
187
187
if let Some ( tool_calls) = msg. tool_calls . as_ref ( ) {
188
+ log:: debug!( "ollama.tool.calls = {:?}" , tool_calls) ;
189
+
188
190
for call in tool_calls {
189
191
let mut attributes = HashMap :: new ( ) ;
190
192
let mut payload = None ;
Original file line number Diff line number Diff line change @@ -37,27 +37,28 @@ impl Action for Shell {
37
37
payload : Option < String > ,
38
38
) -> Result < Option < String > > {
39
39
let command = payload. unwrap ( ) ;
40
+ log:: debug!( "{}" , & command) ;
41
+
40
42
// TODO: make the shell configurable
41
43
let output = Command :: new ( "/bin/sh" )
42
44
. arg ( "-c" )
43
45
. arg ( & command)
44
46
. output ( )
45
47
. await ?;
46
48
47
- let stdout = String :: from_utf8_lossy ( & output. stdout ) . to_string ( ) ;
48
- println ! ( "{}" , & stdout ) ;
49
+ let mut result = String :: from_utf8_lossy ( & output. stdout ) . to_string ( ) ;
50
+ println ! ( "{}" , & result ) ;
49
51
50
52
let stderr = String :: from_utf8_lossy ( & output. stderr ) . to_string ( ) ;
51
53
if !stderr. is_empty ( ) {
52
- eprintln ! ( "{}" , stderr) ;
54
+ eprintln ! ( "{}" , & stderr) ;
55
+ result += & format ! ( "\n STDERR: {}\n " , stderr) ;
53
56
}
54
57
55
- let result = format ! (
56
- "Exit Code: {}\n \n Stdout:\n {}\n \n Stderr:\n {}" ,
57
- output. status. code( ) . unwrap_or( -1 ) ,
58
- stdout,
59
- stderr
60
- ) ;
58
+ let exit_code = output. status . code ( ) . unwrap_or ( -1 ) ;
59
+ if exit_code != 0 {
60
+ result += & format ! ( "\n EXIT CODE: {}" , exit_code) ;
61
+ }
61
62
62
63
log:: debug!( "{}" , & result) ;
63
64
You can’t perform that action at this time.
0 commit comments