@@ -94,41 +94,34 @@ impl SimpleFunctionFactoryBase for Factory {
9494 . required ( ) ?;
9595
9696 // Create API config based on api_key parameter if provided
97- let api_config = if let Some ( api_key ) = & spec. api_key {
98- Some ( match spec. api_type {
99- LlmApiType :: OpenAi => {
100- LlmApiConfig :: OpenAi ( super :: super :: super :: llm:: OpenAiConfig {
97+ let api_config = if let Some ( _api_key ) = & spec. api_key {
98+ match spec. api_type {
99+ LlmApiType :: OpenAi => Some ( LlmApiConfig :: OpenAi (
100+ super :: super :: super :: llm:: OpenAiConfig {
101101 org_id : None ,
102102 project_id : None ,
103- } )
103+ } ,
104+ ) ) ,
105+ LlmApiType :: Anthropic
106+ | LlmApiType :: Gemini
107+ | LlmApiType :: Voyage
108+ | LlmApiType :: LiteLlm
109+ | LlmApiType :: OpenRouter
110+ | LlmApiType :: Vllm => {
111+ // These API types don't require a config, just an API key
112+ None
104113 }
105- LlmApiType :: Anthropic => {
106- LlmApiConfig :: Anthropic ( super :: super :: super :: llm:: AnthropicConfig { } )
107- }
108- LlmApiType :: Gemini => {
109- LlmApiConfig :: Gemini ( super :: super :: super :: llm:: GeminiConfig { } )
110- }
111- LlmApiType :: Voyage => {
112- LlmApiConfig :: Voyage ( super :: super :: super :: llm:: VoyageConfig { } )
113- }
114- LlmApiType :: LiteLlm => {
115- LlmApiConfig :: LiteLlm ( super :: super :: super :: llm:: LiteLlmConfig { } )
116- }
117- LlmApiType :: OpenRouter => {
118- LlmApiConfig :: OpenRouter ( super :: super :: super :: llm:: OpenRouterConfig { } )
119- }
120- LlmApiType :: Vllm => LlmApiConfig :: Vllm ( super :: super :: super :: llm:: VllmConfig { } ) ,
121114 _ => {
122115 if let Some ( config) = spec. api_config . clone ( ) {
123- config
116+ Some ( config)
124117 } else {
125118 api_bail ! (
126119 "API key parameter is not supported for API type {:?}" ,
127120 spec. api_type
128121 )
129122 }
130123 }
131- } )
124+ }
132125 } else {
133126 spec. api_config . clone ( )
134127 } ;
0 commit comments