@@ -28,55 +28,6 @@ pub struct OpenSourceAI {
28
28
database_url : Option < String > ,
29
29
}
30
30
31
- fn try_model_nice_name_to_model_name_and_parameters (
32
- model_name : & str ,
33
- ) -> Option < ( & ' static str , Json ) > {
34
- match model_name {
35
- "meta-llama/Meta-Llama-3-8B-Instruct" => Some ( (
36
- "meta-llama/Meta-Llama-3-8B-Instruct" ,
37
- serde_json:: json!( {
38
- "task" : "conversational" ,
39
- "model" : "meta-llama/Meta-Llama-3-8B-Instruct"
40
- } )
41
- . into ( ) ,
42
- ) ) ,
43
- "meta-llama/Meta-Llama-3-70B-Instruct" => Some ( (
44
- "meta-llama/Meta-Llama-3-70B-Instruct" ,
45
- serde_json:: json!( {
46
- "task" : "conversational" ,
47
- "model" : "meta-llama/Meta-Llama-3-70B-Instruct"
48
- } )
49
- . into ( ) ,
50
- ) ) ,
51
- "microsoft/Phi-3-mini-128k-instruct" => Some ( (
52
- "microsoft/Phi-3-mini-128k-instruct" ,
53
- serde_json:: json!( {
54
- "task" : "conversational" ,
55
- "model" : "microsoft/Phi-3-mini-128k-instruct"
56
- } )
57
- . into ( ) ,
58
- ) ) ,
59
- "mistralai/Mixtral-8x7B-Instruct-v0.1" => Some ( (
60
- "mistralai/Mixtral-8x7B-Instruct-v0.1" ,
61
- serde_json:: json!( {
62
- "task" : "conversational" ,
63
- "model" : "mistralai/Mixtral-8x7B-Instruct-v0.1"
64
- } )
65
- . into ( ) ,
66
- ) ) ,
67
- "mistralai/Mistral-7B-Instruct-v0.2" => Some ( (
68
- "mistralai/Mistral-7B-Instruct-v0.2" ,
69
- serde_json:: json!( {
70
- "task" : "conversational" ,
71
- "model" : "mistralai/Mistral-7B-Instruct-v0.2"
72
- } )
73
- . into ( ) ,
74
- ) ) ,
75
-
76
- _ => None ,
77
- }
78
- }
79
-
80
31
struct AsyncToSyncJsonIterator ( std:: pin:: Pin < Box < dyn Stream < Item = anyhow:: Result < Json > > + Send > > ) ;
81
32
82
33
impl Iterator for AsyncToSyncJsonIterator {
@@ -141,21 +92,25 @@ impl OpenSourceAI {
141
92
let model_name = model
142
93
. as_str ( )
143
94
. context ( "`model` must either be a string or an object" ) ?;
144
- let ( real_model_name, parameters) =
145
- try_model_nice_name_to_model_name_and_parameters ( model_name) . context (
146
- r#"Please select one of the provided models:
147
- mistralai/Mistral-7B-v0.1
148
- "# ,
149
- ) ?;
150
95
Ok ( (
151
96
TransformerPipeline :: new (
152
97
"conversational" ,
153
- real_model_name,
154
- Some ( parameters. clone ( ) ) ,
98
+ model_name,
99
+ Some (
100
+ serde_json:: json!( {
101
+ "task" : "conversational" ,
102
+ "model" : model_name
103
+ } )
104
+ . into ( ) ,
105
+ ) ,
155
106
self . database_url . clone ( ) ,
156
107
) ,
157
108
model_name. to_string ( ) ,
158
- parameters,
109
+ serde_json:: json!( {
110
+ "task" : "conversational" ,
111
+ "model" : model_name
112
+ } )
113
+ . into ( ) ,
159
114
) )
160
115
}
161
116
}
0 commit comments