This commit is contained in:
2026-09-25 19:47:30 +03:30
parent ae2713eddd
commit 22de433023
11 changed files with 60 additions and 192 deletions
+36 -13
View File
@@ -1,19 +1,24 @@
using System;
using OpenAI;
using OllamaSharp;
using System.Net.Http;
using System.Threading;
using xAiApi.Constants;
using xAiApi.Interfaces;
using xAiApi.Extensions;
using System.ClientModel;
using xCommons.Extensions;
using xAiModels.Constants;
using xAiModels.Interfaces;
using xExceptions.Constants;
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using System.Runtime.CompilerServices;
using Microsoft.Extensions.AI;
using xAiModels.Extensions;
using xAiApi.Configurations;
using xAiApi.Extensions;
using System.Net.Http;
using OllamaSharp;
using xExceptions.Constants;
using System.Threading.Tasks;
using Microsoft.Extensions.AI;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using System.ClientModel.Primitives;
using System.Runtime.CompilerServices;
namespace xAiApi.Providers
{
@@ -161,7 +166,7 @@ namespace xAiApi.Providers
switch (modelDescriptor.Provider)
{
//
case Constants.XAiProvider.Ollama:
case XAiModelProviderType.Ollama:
//
// Instance Ollama Client using Custom HttpCLient ...
var ollamaClient = new OllamaApiClient(httpClient, model);
@@ -169,13 +174,31 @@ namespace xAiApi.Providers
new ChatClientBuilder(ollamaClient)
.Build();
break;
//
case Constants.XAiProvider.DeepSeek:
case XAiModelProviderType.OpenAI:
//
// Instance Ollama Client using Custom HttpCLient ...
var llamaClient = new OpenAIClient(
new ApiKeyCredential(apiKey.IsNullOrEmpty() ? XAiApiConstants.XOpenAINoKey : apiKey),
new OpenAIClientOptions
{
Endpoint = url,
Transport = new HttpClientPipelineTransport(httpClient)
}
);
result =
llamaClient
.GetChatClient(model)
.AsIChatClient();
break;
//
case Constants.XAiProvider.HuggingFace:
case XAiModelProviderType.DeepSeek:
break;
//
case XAiModelProviderType.HuggingFace:
break;
//
+9 -8
View File
@@ -1,20 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using OllamaSharp;
using OllamaSharp.Models;
using xAiApi.Configurations;
using System.Threading;
using xAiApi.Constants;
using xAiModels.Models;
using xAiApi.Extensions;
using xAiApi.Interfaces;
using xAiApi.Models;
using xAiModels.Interfaces;
using OllamaSharp.Models;
using xAiService.Helpers;
using xCommons.Extensions;
using xAiModels.Extensions;
using xAiModels.Interfaces;
using xAiApi.Configurations;
using xExceptions.Constants;
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
namespace xAiApi.Providers
{