@@ -70,7 +70,7 @@ impl<'de> serde::Deserialize<'de> for ModelProvider {
7070 }
7171}
7272
73- #[ derive( Debug , Default , Serialize , Deserialize , Clone ) ]
73+ #[ derive( Default , Serialize , Deserialize , Clone ) ]
7474pub ( crate ) struct OpenAISettings {
7575 pub api_base : Option < String > ,
7676 pub api_key : Option < String > ,
@@ -79,6 +79,22 @@ pub(crate) struct OpenAISettings {
7979 pub proxy : Option < String > ,
8080}
8181
82+ impl std:: fmt:: Debug for OpenAISettings {
83+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
84+ f. debug_struct ( "OpenAISettings" )
85+ . field ( "api_base" , & self . api_base )
86+ . field (
87+ "api_key" ,
88+ // obfuscate the api key
89+ & self . api_key . as_ref ( ) . map ( |_| "********" ) ,
90+ )
91+ . field ( "model" , & self . model )
92+ . field ( "retries" , & self . retries )
93+ . field ( "proxy" , & self . proxy )
94+ . finish ( )
95+ }
96+ }
97+
8298// implement the trait `From<OpenAISettings>` for `ValueKind`
8399impl From < OpenAISettings > for config:: ValueKind {
84100 fn from ( settings : OpenAISettings ) -> Self {
0 commit comments