last works on AiApi:
- Default Ai Service and Controller; - Default Embeding and Controller; - ...
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using OllamaSharp;
|
||||
|
||||
namespace xAiApi.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Base Embedding Provider Service ...
|
||||
/// </summary>
|
||||
public interface IXAiEmbeddingServiceBase : IXAiServiceBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Embedding Specified String ...
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<float[]> Embeding(
|
||||
string content,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Embedding Specified Batch ...
|
||||
/// </summary>
|
||||
/// <param name="batch"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IReadOnlyList<float[]>> Embedings(
|
||||
string[] batch,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Access Embedding Client ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
OllamaApiClient GetEmbeddingClient();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace xAiApi.Interfaces
|
||||
{
|
||||
public interface IXAiEmbeddingServiceControllerBase : IXAiServiceControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Request For Embedding Specified String ...
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Embeding")]
|
||||
Task<ActionResult<float[]>> Embeding(
|
||||
[FromQuery] string content,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Request For Embedding Specified Batch ...
|
||||
/// </summary>
|
||||
/// <param name="batch"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Embedings")]
|
||||
Task<ActionResult<IReadOnlyList<float[]>>> Embedings(
|
||||
[FromQuery] string[] batch,
|
||||
CancellationToken cancellationToken = default
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace xAiApi.Interfaces
|
||||
{
|
||||
public interface IXDefaultEmbeddingService : IXAiEmbeddingServiceBase
|
||||
{ }
|
||||
}
|
||||
Reference in New Issue
Block a user