File tree Expand file tree Collapse file tree
src/MaIN.Services/Services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,6 +107,16 @@ private PromptExecutionSettings InitializeChatCompletions(IKernelBuilder kernelB
107107 ExtensionData = new Dictionary < string , object > { [ "max_tokens" ] = 4096 }
108108 } ;
109109
110+ case BackendType . Xai :
111+ kernelBuilder . Services . AddOpenAIChatCompletion (
112+ modelId : model ,
113+ apiKey : GetXaiKey ( ) ?? throw new ArgumentNullException ( nameof ( GetXaiKey ) ) ,
114+ endpoint : new Uri ( "https://api.x.ai/v1" ) ) ;
115+ return new OpenAIPromptExecutionSettings ( )
116+ {
117+ FunctionChoiceBehavior = FunctionChoiceBehavior . Auto ( options : new ( ) { RetainArgumentTypes = true } )
118+ } ;
119+
110120 case BackendType . Self :
111121 throw new NotSupportedException ( "Self backend (local models) does not support MCP integration." ) ;
112122
@@ -123,4 +133,6 @@ private PromptExecutionSettings InitializeChatCompletions(IKernelBuilder kernelB
123133 => settings . GroqCloudKey ?? Environment . GetEnvironmentVariable ( "GROQ_API_KEY" ) ;
124134 string ? GetAnthropicKey ( )
125135 => settings . AnthropicKey ?? Environment . GetEnvironmentVariable ( "ANTHROPIC_API_KEY" ) ;
136+ string ? GetXaiKey ( )
137+ => settings . XaiKey ?? Environment . GetEnvironmentVariable ( "XAI_API_KEY" ) ;
126138}
You can’t perform that action at this time.
0 commit comments