Skip to content

Commit 29c7850

Browse files
committed
further from traits
1 parent 2b4a658 commit 29c7850

File tree

1 file changed

+16
-1
lines changed
  • async-openai/src/types/responses

1 file changed

+16
-1
lines changed

async-openai/src/types/responses/sdk.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::types::responses::{
1313
TextResponseFormatConfiguration, Tool, ToolChoiceCustom, ToolChoiceFunction, ToolChoiceMCP,
1414
ToolChoiceOptions, ToolChoiceParam, ToolChoiceTypes, WebSearchTool, WebSearchToolCall,
1515
};
16-
use crate::types::MCPTool;
16+
use crate::types::{chat::ResponseFormatJsonSchema, MCPTool};
1717

1818
impl<S: Into<String>> From<S> for EasyInputMessage {
1919
fn from(value: S) -> Self {
@@ -33,6 +33,12 @@ impl From<EasyInputMessage> for InputItem {
3333

3434
// InputItem ergonomics
3535

36+
impl From<InputMessage> for InputItem {
37+
fn from(msg: InputMessage) -> Self {
38+
InputItem::Item(Item::Message(MessageItem::Input(msg)))
39+
}
40+
}
41+
3642
impl From<Item> for InputItem {
3743
fn from(item: Item) -> Self {
3844
InputItem::Item(item)
@@ -227,6 +233,15 @@ impl From<TextResponseFormatConfiguration> for ResponseTextParam {
227233
}
228234
}
229235

236+
impl From<ResponseFormatJsonSchema> for ResponseTextParam {
237+
fn from(schema: ResponseFormatJsonSchema) -> Self {
238+
ResponseTextParam {
239+
format: TextResponseFormatConfiguration::JsonSchema(schema),
240+
verbosity: None,
241+
}
242+
}
243+
}
244+
230245
// ResponseStreamOptions ergonomics
231246

232247
impl From<bool> for ResponseStreamOptions {

0 commit comments

Comments
 (0)