@@ -113,68 +113,4 @@ mod durable_impl {
113113 err. clone ( )
114114 }
115115 }
116-
117- #[ cfg( test) ]
118- mod tests {
119- use crate :: durability:: durable_impl:: { GenerateInput , RerankInput } ;
120- use crate :: golem:: embed:: embed:: { Config , ContentPart , ImageUrl , TaskType } ;
121- use golem_rust:: value_and_type:: { FromValueAndType , IntoValueAndType } ;
122- use std:: fmt:: Debug ;
123-
124- fn roundtrip_test < T : Debug + Clone + PartialEq + IntoValueAndType + FromValueAndType > (
125- value : T ,
126- ) {
127- let vnt = value. clone ( ) . into_value_and_type ( ) ;
128- let extracted = T :: from_value_and_type ( vnt) . unwrap ( ) ;
129- assert_eq ! ( value, extracted) ;
130- }
131-
132- #[ test]
133- fn generate_input_encoding ( ) {
134- let input = GenerateInput {
135- inputs : vec ! [
136- ContentPart :: Text ( "Hello world" . to_string( ) ) ,
137- ContentPart :: Image ( ImageUrl {
138- url: "https://example.com/image.png" . to_string( ) ,
139- } ) ,
140- ] ,
141- config : Config {
142- model : Some ( "text-embedding-3-small" . to_string ( ) ) ,
143- task_type : Some ( TaskType :: RetrievalQuery ) ,
144- dimensions : Some ( 512 ) ,
145- truncation : Some ( true ) ,
146- output_format : None ,
147- output_dtype : None ,
148- user : Some ( "test-user" . to_string ( ) ) ,
149- provider_options : vec ! [ ] ,
150- } ,
151- } ;
152-
153- roundtrip_test ( input) ;
154- }
155-
156- #[ test]
157- fn rerank_input_encoding ( ) {
158- let input = RerankInput {
159- query : "What is machine learning?" . to_string ( ) ,
160- documents : vec ! [
161- "Machine learning is a subset of AI" . to_string( ) ,
162- "Deep learning uses neural networks" . to_string( ) ,
163- "NLP processes human language" . to_string( ) ,
164- ] ,
165- config : Config {
166- model : Some ( "rerank-english-v3.0" . to_string ( ) ) ,
167- task_type : None ,
168- dimensions : None ,
169- truncation : None ,
170- output_format : None ,
171- output_dtype : None ,
172- user : None ,
173- provider_options : vec ! [ ] ,
174- } ,
175- } ;
176-
177- roundtrip_test ( input) ;
178- }
179- }
180116}
0 commit comments