Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ schemars = { version = "1.0.0-alpha.17", default-features = false }
schemars_08 = { package = "schemars", version = "0.8.22", default-features = false }
schematic = { git = "https://github.com/JeanMertz/schematic", branch = "merged", default-features = false }
serde = { version = "1", default-features = false }
serde-untagged = { version = "0.1", default-features = false }
serde_json = { version = "1", default-features = false }
serde_json5 = { version = "0.2", default-features = false }
serde_yaml = { version = "0.9", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions crates/jp_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ schematic = { workspace = true, features = [
"type_url",
] }
serde = { workspace = true, features = ["derive"] }
serde-untagged = { workspace = true }
serde_json = { workspace = true, features = ["preserve_order"] }
serde_json5 = { workspace = true }
serde_yaml = { workspace = true }
Expand Down
56 changes: 28 additions & 28 deletions crates/jp_config/src/assistant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
partial::{ToPartial, partial_opt, partial_opt_config, partial_opts},
types::{
string::{MergeableString, PartialMergeableString, PartialMergedString},
vec::{MergeableVec, MergedVec, MergedVecStrategy},
vec::{MergeableVec, MergedVec},
},
};

Expand Down Expand Up @@ -102,8 +102,8 @@ impl ToPartial for AssistantConfig {
#[expect(clippy::trivially_copy_pass_by_ref, clippy::unnecessary_wraps)]
fn default_instructions(_: &()) -> TransformResult<MergeableVec<PartialInstructionsConfig>> {
Ok(MergeableVec::Merged(MergedVec {
strategy: MergedVecStrategy::Replace,
is_default: true,
strategy: None,
discard_when_merged: true,
value: vec![PartialInstructionsConfig {
title: Some("How to respond to the user".into()),
items: Some(vec![
Expand All @@ -130,7 +130,7 @@ fn default_system_prompt(_: &()) -> TransformResult<Option<PartialMergeableStrin
value: Some("You are a helpful assistant.".to_owned()),
strategy: None,
separator: None,
is_default: Some(true),
discard_when_merged: Some(true),
})))
}

Expand Down Expand Up @@ -163,7 +163,7 @@ mod tests {
assert_eq!(
p.instructions,
MergeableVec::Merged(MergedVec {
strategy: MergedVecStrategy::Replace,
strategy: None,
value: vec![PartialInstructionsConfig {
title: Some("foo".into()),
..Default::default()
Expand All @@ -172,10 +172,10 @@ mod tests {
// field is `true`, and when we do `try_from_cli` we trigger
// `try_vec_of_nested` on `&mut [PartialInstructionsConfig]`,
// NOT on the `MergeableVec<PartialInstructionsConfig>`. This
// means `is_default` is left untouched. This is *correct*, but
// it might be confusing in some cases, so we might want to
// change this in the future.
is_default: true,
// means `discard_when_merged` is left untouched. This is
// *correct*, but it might be confusing in some cases, so we
// might want to change this in the future.
discard_when_merged: true,
})
);

Expand All @@ -188,7 +188,7 @@ mod tests {
assert_eq!(
p.instructions,
MergeableVec::Merged(MergedVec {
strategy: MergedVecStrategy::Replace,
strategy: None,
value: vec![
PartialInstructionsConfig {
title: Some("foo".into()),
Expand All @@ -200,7 +200,7 @@ mod tests {
..Default::default()
}
],
is_default: true,
discard_when_merged: true,
})
);

Expand All @@ -209,7 +209,7 @@ mod tests {
assert_eq!(
p.instructions,
MergeableVec::Merged(MergedVec {
strategy: MergedVecStrategy::Replace,
strategy: None,
value: vec![
PartialInstructionsConfig {
title: Some("foo".into()),
Expand All @@ -225,7 +225,7 @@ mod tests {
..Default::default()
}
],
is_default: true,
discard_when_merged: true,
})
);

Expand All @@ -234,12 +234,12 @@ mod tests {
assert_eq!(
p.instructions,
MergeableVec::Merged(MergedVec {
strategy: MergedVecStrategy::Replace,
strategy: None,
value: vec![PartialInstructionsConfig {
title: Some("qux".into()),
..Default::default()
}],
is_default: true,
discard_when_merged: true,
})
);

Expand All @@ -248,12 +248,12 @@ mod tests {
assert_eq!(
p.instructions,
MergeableVec::Merged(MergedVec {
strategy: MergedVecStrategy::Replace,
strategy: None,
value: vec![PartialInstructionsConfig {
title: Some("boop".into()),
..Default::default()
}],
is_default: true,
discard_when_merged: true,
})
);

Expand All @@ -265,13 +265,13 @@ mod tests {
assert_eq!(
p.instructions,
MergeableVec::Merged(MergedVec {
strategy: MergedVecStrategy::Replace,
strategy: None,
value: vec![PartialInstructionsConfig {
title: Some("quux".into()),
items: Some(vec!["one".into()]),
..Default::default()
}],
is_default: true,
discard_when_merged: true,
})
);

Expand All @@ -280,13 +280,13 @@ mod tests {
assert_eq!(
p.instructions,
MergeableVec::Merged(MergedVec {
strategy: MergedVecStrategy::Replace,
strategy: None,
value: vec![PartialInstructionsConfig {
title: Some("quux".into()),
items: Some(vec!["two".into()]),
..Default::default()
}],
is_default: true,
discard_when_merged: true,
})
);

Expand All @@ -311,7 +311,7 @@ mod tests {
value: Some("foo".into()),
strategy: None,
separator: None,
is_default: None,
discard_when_merged: None,
}))
);

Expand All @@ -325,7 +325,7 @@ mod tests {
value: Some("foo".into()),
strategy: Some(MergedStringStrategy::Append),
separator: None,
is_default: None,
discard_when_merged: None,
}))
);

Expand All @@ -341,7 +341,7 @@ mod tests {
value: Some("foo".into()),
strategy: Some(MergedStringStrategy::Append),
separator: Some(MergedStringSeparator::Space),
is_default: None,
discard_when_merged: None,
}))
);
}
Expand Down Expand Up @@ -441,7 +441,7 @@ mod tests {
items: None,
examples: vec![],
}],
strategy: MergedVecStrategy::Append,
strategy: Some(MergedVecStrategy::Append),
..Default::default()
}
.into(),
Expand All @@ -465,7 +465,7 @@ mod tests {
examples: vec![],
},
],
strategy: MergedVecStrategy::Append,
strategy: Some(MergedVecStrategy::Append),
..Default::default()
}
.into(),
Expand Down Expand Up @@ -555,7 +555,7 @@ mod tests {
value: Some("foo".into()),
strategy: Some(MergedStringStrategy::Append),
separator: Some(MergedStringSeparator::Paragraph),
is_default: None,
discard_when_merged: None,
})),
instructions: MergedVec {
value: vec![
Expand All @@ -574,7 +574,7 @@ mod tests {
examples: vec![],
},
],
strategy: MergedVecStrategy::Append,
strategy: Some(MergedVecStrategy::Append),
..Default::default()
}
.into(),
Expand Down
Loading
Loading