1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! # types
//!
//! Core data structures used for interacting with the GitHub Models API.
//!
//! This module defines the request and response types for chat-based model inference,
//! including message formatting and response parsing. These types are used by the
//! `GHModels` client to send prompts and receive completions.
use ;
/// Represents a single message in a chat conversation.
///
/// Each message has a `role` (e.g., `"system"`, `"user"`, or `"assistant"`)
/// and a `content` string containing the message text.
/// The top-level response returned from the GitHub Models API.
///
/// Contains a list of `ChatChoice` objects representing possible completions.
///
/// # Example
/// ```rust
/// let response: ChatResponse = client.chat_completion(...).await.unwrap();
/// for choice in response.choices {
/// println!("{}", choice.message.content);
/// }
/// ```
/// Represents a single completion choice returned by the model.
///
/// Each choice contains a `ChatMessage` with the model's response.
///
/// # Example
/// ```rust
/// let choice: &ChatChoice = &response.choices[0];
/// println!("Model replied: {}", choice.message.content);
/// ```