@@ -48,7 +48,7 @@ pub const SEARCH_RESULT_LOCATION_TYPE: &str = "search_result_location";
4848pub const WEB_SEARCH_TOOL_RESULT_ERROR_TYPE : & str = "web_search_tool_result_error" ;
4949
5050#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
51- #[ pyclass]
51+ #[ pyclass( from_py_object ) ]
5252pub struct CitationCharLocationParam {
5353 #[ pyo3( get, set) ]
5454 pub cited_text : String ,
@@ -87,7 +87,7 @@ impl CitationCharLocationParam {
8787}
8888
8989#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
90- #[ pyclass]
90+ #[ pyclass( from_py_object ) ]
9191pub struct CitationPageLocationParam {
9292 #[ pyo3( get, set) ]
9393 pub cited_text : String ,
@@ -126,7 +126,7 @@ impl CitationPageLocationParam {
126126}
127127
128128#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
129- #[ pyclass]
129+ #[ pyclass( from_py_object ) ]
130130pub struct CitationContentBlockLocationParam {
131131 #[ pyo3( get, set) ]
132132 pub cited_text : String ,
@@ -165,7 +165,7 @@ impl CitationContentBlockLocationParam {
165165}
166166
167167#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
168- #[ pyclass]
168+ #[ pyclass( from_py_object ) ]
169169pub struct CitationWebSearchResultLocationParam {
170170 #[ pyo3( get, set) ]
171171 pub cited_text : String ,
@@ -195,7 +195,7 @@ impl CitationWebSearchResultLocationParam {
195195}
196196
197197#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
198- #[ pyclass]
198+ #[ pyclass( from_py_object ) ]
199199pub struct CitationSearchResultLocationParam {
200200 #[ pyo3( get, set) ]
201201 pub cited_text : String ,
@@ -249,7 +249,7 @@ pub enum TextCitationParam {
249249}
250250
251251#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
252- #[ pyclass]
252+ #[ pyclass( from_py_object ) ]
253253pub struct TextBlockParam {
254254 #[ pyo3( get, set) ]
255255 pub text : String ,
@@ -329,7 +329,7 @@ impl TextBlockParam {
329329}
330330
331331#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
332- #[ pyclass]
332+ #[ pyclass( from_py_object ) ]
333333pub struct Base64ImageSource {
334334 #[ pyo3( get, set) ]
335335 pub media_type : String ,
@@ -357,7 +357,7 @@ impl Base64ImageSource {
357357}
358358
359359#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
360- #[ pyclass]
360+ #[ pyclass( from_py_object ) ]
361361pub struct UrlImageSource {
362362 #[ pyo3( get, set) ]
363363 pub url : String ,
@@ -385,7 +385,7 @@ pub enum ImageSource {
385385}
386386
387387#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
388- #[ pyclass]
388+ #[ pyclass( from_py_object ) ]
389389pub struct ImageBlockParam {
390390 pub source : ImageSource ,
391391 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -432,7 +432,7 @@ impl ImageBlockParam {
432432}
433433
434434#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
435- #[ pyclass]
435+ #[ pyclass( from_py_object ) ]
436436pub struct Base64PDFSource {
437437 #[ pyo3( get, set) ]
438438 pub media_type : String ,
@@ -456,7 +456,7 @@ impl Base64PDFSource {
456456}
457457
458458#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
459- #[ pyclass]
459+ #[ pyclass( from_py_object ) ]
460460pub struct UrlPDFSource {
461461 #[ pyo3( get, set) ]
462462 pub url : String ,
@@ -477,7 +477,7 @@ impl UrlPDFSource {
477477}
478478
479479#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
480- #[ pyclass]
480+ #[ pyclass( from_py_object ) ]
481481pub struct PlainTextSource {
482482 #[ pyo3( get, set) ]
483483 pub media_type : String ,
@@ -501,7 +501,7 @@ impl PlainTextSource {
501501}
502502
503503#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
504- #[ pyclass]
504+ #[ pyclass( from_py_object ) ]
505505pub struct CitationsConfigParams {
506506 #[ pyo3( get, set) ]
507507 pub enabled : Option < bool > ,
@@ -516,7 +516,7 @@ pub enum DocumentSource {
516516}
517517
518518#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
519- #[ pyclass]
519+ #[ pyclass( from_py_object ) ]
520520pub struct DocumentBlockParam {
521521 pub source : DocumentSource ,
522522 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -567,7 +567,7 @@ impl DocumentBlockParam {
567567}
568568
569569#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
570- #[ pyclass]
570+ #[ pyclass( from_py_object ) ]
571571pub struct SearchResultBlockParam {
572572 #[ pyo3( get, set) ]
573573 pub content : Vec < TextBlockParam > ,
@@ -607,7 +607,7 @@ impl SearchResultBlockParam {
607607}
608608
609609#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
610- #[ pyclass]
610+ #[ pyclass( from_py_object ) ]
611611pub struct ThinkingBlockParam {
612612 #[ pyo3( get, set) ]
613613 pub thinking : String ,
@@ -632,7 +632,7 @@ impl ThinkingBlockParam {
632632}
633633
634634#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
635- #[ pyclass]
635+ #[ pyclass( from_py_object ) ]
636636pub struct RedactedThinkingBlockParam {
637637 #[ pyo3( get, set) ]
638638 pub data : String ,
@@ -653,7 +653,7 @@ impl RedactedThinkingBlockParam {
653653}
654654
655655#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
656- #[ pyclass]
656+ #[ pyclass( from_py_object ) ]
657657pub struct ToolUseBlockParam {
658658 #[ pyo3( get, set) ]
659659 pub id : String ,
@@ -705,7 +705,7 @@ pub enum ToolResultContentEnum {
705705}
706706
707707#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
708- #[ pyclass]
708+ #[ pyclass( from_py_object ) ]
709709pub struct ToolResultBlockParam {
710710 #[ pyo3( get, set) ]
711711 pub tool_use_id : String ,
@@ -822,7 +822,7 @@ impl ToolResultBlockParam {
822822}
823823
824824#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
825- #[ pyclass]
825+ #[ pyclass( from_py_object ) ]
826826pub struct ServerToolUseBlockParam {
827827 #[ pyo3( get, set) ]
828828 pub id : String ,
@@ -863,7 +863,7 @@ impl ServerToolUseBlockParam {
863863}
864864
865865#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
866- #[ pyclass]
866+ #[ pyclass( from_py_object ) ]
867867pub struct WebSearchResultBlockParam {
868868 #[ pyo3( get, set) ]
869869 pub encrypted_content : String ,
@@ -899,7 +899,7 @@ impl WebSearchResultBlockParam {
899899}
900900
901901#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
902- #[ pyclass]
902+ #[ pyclass( from_py_object ) ]
903903pub struct WebSearchToolResultBlockParam {
904904 #[ pyo3( get, set) ]
905905 pub tool_use_id : String ,
@@ -1156,7 +1156,7 @@ impl ContentBlockParam {
11561156}
11571157
11581158#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1159- #[ pyclass]
1159+ #[ pyclass( from_py_object ) ]
11601160pub struct MessageParam {
11611161 pub content : Vec < ContentBlockParam > ,
11621162 #[ pyo3( get) ]
@@ -1417,7 +1417,7 @@ impl MessageConversion for MessageParam {
14171417}
14181418
14191419#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1420- #[ pyclass]
1420+ #[ pyclass( from_py_object ) ]
14211421pub struct Metadata {
14221422 #[ serde( skip_serializing_if = "Option::is_none" ) ]
14231423 pub user_id : Option < String > ,
@@ -1433,7 +1433,7 @@ impl Metadata {
14331433}
14341434
14351435#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1436- #[ pyclass]
1436+ #[ pyclass( from_py_object ) ]
14371437pub struct CacheControl {
14381438 #[ serde( rename = "type" ) ]
14391439 pub cache_type : String , // "ephemeral"
@@ -1451,7 +1451,7 @@ impl CacheControl {
14511451}
14521452
14531453#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1454- #[ pyclass( name = "AnthropicTool" ) ]
1454+ #[ pyclass( from_py_object , name = "AnthropicTool" ) ]
14551455pub struct Tool {
14561456 pub name : String ,
14571457 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -1497,7 +1497,7 @@ impl Tool {
14971497}
14981498
14991499#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1500- #[ pyclass( name = "AnthropicThinkingConfig" ) ]
1500+ #[ pyclass( from_py_object , name = "AnthropicThinkingConfig" ) ]
15011501pub struct ThinkingConfig {
15021502 #[ pyo3( get) ]
15031503 pub r#type : String ,
@@ -1520,7 +1520,7 @@ impl ThinkingConfig {
15201520}
15211521
15221522#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1523- #[ pyclass( name = "AnthropicToolChoice" ) ]
1523+ #[ pyclass( from_py_object , name = "AnthropicToolChoice" ) ]
15241524pub struct ToolChoice {
15251525 #[ pyo3( get) ]
15261526 pub r#type : String , // "auto", "any", "tool", "none"
@@ -1566,7 +1566,7 @@ impl ToolChoice {
15661566}
15671567
15681568#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1569- #[ pyclass]
1569+ #[ pyclass( from_py_object ) ]
15701570#[ serde( default ) ]
15711571pub struct AnthropicSettings {
15721572 #[ pyo3( get) ]
@@ -1829,7 +1829,7 @@ impl RequestAdapter for AnthropicMessageRequestV1 {
18291829}
18301830
18311831#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1832- #[ pyclass]
1832+ #[ pyclass( from_py_object ) ]
18331833pub struct SystemPrompt {
18341834 #[ pyo3( get) ]
18351835 #[ serde( flatten) ]
0 commit comments