mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
Tighten imagegen basic tool contract
This commit is contained in:
@@ -214,9 +214,13 @@ async fn basic_image_generation_stays_in_conversation() -> Result<()> {
|
||||
let tool = requests[0]
|
||||
.tool_by_name("image_gen", "imagegen")
|
||||
.context("basic imagegen tool should be sent to the model")?;
|
||||
assert!(
|
||||
tool.pointer("/parameters/properties/referenced_image_paths")
|
||||
.is_none()
|
||||
let properties = tool
|
||||
.pointer("/parameters/properties")
|
||||
.and_then(serde_json::Value::as_object)
|
||||
.context("basic imagegen should define properties")?;
|
||||
assert_eq!(
|
||||
properties.keys().map(String::as_str).collect::<Vec<_>>(),
|
||||
vec!["num_last_images_to_include", "prompt"]
|
||||
);
|
||||
assert!(
|
||||
tool["description"]
|
||||
|
||||
@@ -18,7 +18,6 @@ use codex_tools::ResponsesApiNamespaceTool;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use super::GeneratedImageOutput;
|
||||
use super::IMAGEGEN_BASIC_DESCRIPTION;
|
||||
use super::ImageRequest;
|
||||
use super::ImagegenArgs;
|
||||
use super::imagegen_tool_spec;
|
||||
@@ -38,27 +37,6 @@ fn uses_reserved_image_gen_namespace() {
|
||||
assert_eq!(function.name, IMAGEGEN_TOOL_NAME);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic_model_contract_omits_filesystem_paths() {
|
||||
let ToolSpec::Namespace(basic) = imagegen_tool_spec(/*basic*/ true) else {
|
||||
panic!("basic imagegen should advertise a namespace tool");
|
||||
};
|
||||
let ResponsesApiNamespaceTool::Function(basic) = &basic.tools[0];
|
||||
let basic_properties = basic
|
||||
.parameters
|
||||
.properties
|
||||
.as_ref()
|
||||
.expect("basic imagegen should define properties");
|
||||
assert_eq!(
|
||||
basic_properties.keys().cloned().collect::<Vec<_>>(),
|
||||
vec![
|
||||
"num_last_images_to_include".to_string(),
|
||||
"prompt".to_string(),
|
||||
]
|
||||
);
|
||||
assert_eq!(basic.description, IMAGEGEN_BASIC_DESCRIPTION);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn omitted_references_generate_with_fixed_defaults() {
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user