Reasoning-model response: the object (and/or thinking) is in the reasoning channel, `content` may be empty, and there is no tool call — the shape that GLM/zhipu reasoning models produce and that used to fail generate_object.
(reasoning: &str, content: &str)
| 66 | /// channel, `content` may be empty, and there is no tool call — the shape that |
| 67 | /// GLM/zhipu reasoning models produce and that used to fail generate_object. |
| 68 | fn reasoning_response(reasoning: &str, content: &str) -> LlmResponse { |
| 69 | LlmResponse { |
| 70 | message: Message { |
| 71 | role: "assistant".to_string(), |
| 72 | content: if content.is_empty() { |
| 73 | vec![] |
| 74 | } else { |
| 75 | vec![ContentBlock::Text { |
| 76 | text: content.to_string(), |
| 77 | }] |
| 78 | }, |
| 79 | reasoning_content: Some(reasoning.to_string()), |
| 80 | }, |
| 81 | usage: TokenUsage { |
| 82 | prompt_tokens: 10, |
| 83 | completion_tokens: 5, |
| 84 | total_tokens: 15, |
| 85 | cache_read_tokens: None, |
| 86 | cache_write_tokens: None, |
| 87 | }, |
| 88 | stop_reason: Some("end_turn".to_string()), |
| 89 | meta: None, |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | #[async_trait] |