@@ -8,6 +8,31 @@ use arms::types::responses;
88mod tests {
99 use super :: * ;
1010
11+ #[ tokio:: test]
12+ async fn test_completion ( ) {
13+ from_filename ( ".env.integration-test" ) . ok ( ) ;
14+
15+ let config = client:: Config :: builder ( )
16+ . provider ( "faker" )
17+ . model (
18+ client:: ModelConfig :: builder ( )
19+ . name ( "fake-completion-model" )
20+ . build ( )
21+ . unwrap ( ) ,
22+ )
23+ . build ( )
24+ . unwrap ( ) ;
25+
26+ let client = client:: Client :: new ( config) ;
27+ let request = chat:: CreateChatCompletionRequestArgs :: default ( )
28+ . build ( )
29+ . unwrap ( ) ;
30+
31+ let response = client. create_completion ( request) . await . unwrap ( ) ;
32+ assert ! ( response. id. starts_with( "fake-completion-id" ) ) ;
33+ assert ! ( response. model == "fake-completion-model" ) ;
34+ }
35+
1136 #[ tokio:: test]
1237 async fn test_response ( ) {
1338 from_filename ( ".env.integration-test" ) . ok ( ) ;
@@ -24,7 +49,7 @@ mod tests {
2449 . build ( )
2550 . unwrap ( ) ;
2651
27- let mut client = client:: Client :: new ( config) ;
52+ let client = client:: Client :: new ( config) ;
2853 let request = responses:: CreateResponseArgs :: default ( )
2954 . input ( "tell me the weather today" )
3055 . build ( )
@@ -45,7 +70,7 @@ mod tests {
4570 )
4671 . build ( )
4772 . unwrap ( ) ;
48- let mut client = client:: Client :: new ( config) ;
73+ let client = client:: Client :: new ( config) ;
4974 let request = responses:: CreateResponseArgs :: default ( )
5075 . model ( "gpt-3.5-turbo" )
5176 . input ( "tell me a joke" )
@@ -74,36 +99,11 @@ mod tests {
7499 )
75100 . build ( )
76101 . unwrap ( ) ;
77- let mut client = client:: Client :: new ( config) ;
102+ let client = client:: Client :: new ( config) ;
78103 let request = responses:: CreateResponseArgs :: default ( )
79104 . input ( "give me a poem about nature" )
80105 . build ( )
81106 . unwrap ( ) ;
82107 let _ = client. create_response ( request) . await . unwrap ( ) ;
83108 }
84-
85- #[ tokio:: test]
86- async fn test_completion ( ) {
87- from_filename ( ".env.integration-test" ) . ok ( ) ;
88-
89- let config = client:: Config :: builder ( )
90- . provider ( "faker" )
91- . model (
92- client:: ModelConfig :: builder ( )
93- . name ( "fake-completion-model" )
94- . build ( )
95- . unwrap ( ) ,
96- )
97- . build ( )
98- . unwrap ( ) ;
99-
100- let mut client = client:: Client :: new ( config) ;
101- let request = chat:: CreateChatCompletionRequestArgs :: default ( )
102- . build ( )
103- . unwrap ( ) ;
104-
105- let response = client. create_completion ( request) . await . unwrap ( ) ;
106- assert ! ( response. id. starts_with( "fake-completion-id" ) ) ;
107- assert ! ( response. model == "fake-completion-model" ) ;
108- }
109109}
0 commit comments