"feat(ml_interface): add prompt validation to make_request function"
This commit is contained in:
parent
f96ab7523e
commit
8445e2f076
@ -75,11 +75,15 @@ impl MlInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub fn make_request(
|
pub fn make_request(&mut self, gen_data: MlBody) -> Result<reqwest::blocking::Response, &str> {
|
||||||
&mut self,
|
if gen_data.prompt.len() < 1 {
|
||||||
gen_data: MlBody,
|
panic!("No prompt provided");
|
||||||
) -> Result<reqwest::blocking::Response, reqwest::Error> {
|
}
|
||||||
let json_body = serde_json::to_string(&gen_data).unwrap();
|
let json_body = serde_json::to_string(&gen_data).unwrap();
|
||||||
self.client.post(OLLAMA_ENDP).body(json_body).send()
|
let res = self.client.post(OLLAMA_ENDP).body(json_body).send();
|
||||||
|
if res.is_err() {
|
||||||
|
panic!("Failed to send ollama payload");
|
||||||
|
}
|
||||||
|
Ok(res.unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user