Make serialization backwards-compatible for collab server (#27626)
Sets up the collab server to accept the format of system message that we'll introduce later for [prompt caching](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching). Release Notes: - N/A
This commit is contained in:
parent
6550a96e15
commit
85740ddaa4
2 changed files with 13 additions and 2 deletions
|
@ -585,6 +585,13 @@ pub enum Thinking {
|
|||
Enabled { budget_tokens: Option<u32> },
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum StringOrContents {
|
||||
String(String),
|
||||
Content(Vec<RequestContent>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Request {
|
||||
pub model: String,
|
||||
|
@ -597,7 +604,7 @@ pub struct Request {
|
|||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub tool_choice: Option<ToolChoice>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub system: Option<String>,
|
||||
pub system: Option<StringOrContents>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub metadata: Option<Metadata>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue