changes
This commit is contained in:
parent
524580eb25
commit
ffe080adef
82 changed files with 2652 additions and 2956 deletions
|
|
@ -40,22 +40,6 @@ pub async fn ollama_chat(
|
|||
})
|
||||
}
|
||||
|
||||
/// Extract content from OpenAI-compatible response (`choices[0].message.content`)
|
||||
pub fn extract_openai_content(json: &Value) -> Result<&str, LlmError> {
|
||||
json.get("choices")
|
||||
.and_then(|ch| ch.get(0))
|
||||
.and_then(|ch| ch.get("message"))
|
||||
.and_then(|msg| msg.get("content"))
|
||||
.and_then(|ct| ct.as_str())
|
||||
.ok_or_else(|| {
|
||||
warn!("Malformed OpenAI response: missing choices[0].message.content");
|
||||
(
|
||||
StatusCode::BAD_GATEWAY,
|
||||
"Malformed LLM response: missing choices[0].message.content".into(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// Extract content from Ollama native response (`message.content`)
|
||||
pub fn extract_ollama_content(json: &Value) -> Result<&str, LlmError> {
|
||||
json.get("message")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue