Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T04:03:49.266Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

open_ai_response.rs

32 lines · 1.1 KB · rust
1pub fn text_from_response(mut res: open_ai::Response) -> Option<String> {
2    let choice = res.choices.pop()?;
3    let output_text = match choice.message {
4        open_ai::RequestMessage::Assistant {
5            content: Some(open_ai::MessageContent::Plain(content)),
6            ..
7        } => content,
8        open_ai::RequestMessage::Assistant {
9            content: Some(open_ai::MessageContent::Multipart(mut content)),
10            ..
11        } => {
12            if content.is_empty() {
13                log::error!("No output from Baseten completion response");
14                return None;
15            }
16
17            match content.remove(0) {
18                open_ai::MessagePart::Text { text } => text,
19                open_ai::MessagePart::Image { .. } => {
20                    log::error!("Expected text, got an image");
21                    return None;
22                }
23            }
24        }
25        _ => {
26            log::error!("Invalid response message: {:?}", choice.message);
27            return None;
28        }
29    };
30    Some(output_text)
31}
32
Served at tenant.openagents/omega Member data and write actions are omitted.