@@ -80,23 +80,26 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
8080 let arguments = function_call. arguments . clone ( ) . unwrap ( ) ;
8181 let c: Currency = serde_json:: from_str ( & arguments) ?;
8282 let coin = c. coin ;
83-
83+
8484 let req = ChatCompletionRequest {
8585 model : chat_completion:: GPT3_5_TURBO_0613 . to_string ( ) ,
86- messages : vec ! [ chat_completion:: ChatCompletionMessage {
87- role: chat_completion:: MessageRole :: user,
88- content: Some ( String :: from( "What is the price of Ethereum?" ) ) ,
89- name: None ,
90- function_call: None ,
91- } , chat_completion:: ChatCompletionMessage {
92- role: chat_completion:: MessageRole :: function,
93- content: Some ( {
94- let price = get_coin_price( & coin) . await ;
95- format!( "{{\" price\" : {}}}" , price)
96- } ) ,
97- name: Some ( String :: from( "get_coin_price" ) ) ,
98- function_call: None ,
99- } ] ,
86+ messages : vec ! [
87+ chat_completion:: ChatCompletionMessage {
88+ role: chat_completion:: MessageRole :: user,
89+ content: Some ( String :: from( "What is the price of Ethereum?" ) ) ,
90+ name: None ,
91+ function_call: None ,
92+ } ,
93+ chat_completion:: ChatCompletionMessage {
94+ role: chat_completion:: MessageRole :: function,
95+ content: Some ( {
96+ let price = get_coin_price( & coin) . await ;
97+ format!( "{{\" price\" : {}}}" , price)
98+ } ) ,
99+ name: Some ( String :: from( "get_coin_price" ) ) ,
100+ function_call: None ,
101+ } ,
102+ ] ,
100103 functions : None ,
101104 function_call : None ,
102105 temperature : None ,
0 commit comments