Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Cellm.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cellm", "src\Cellm\Cellm.cs
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cellm.Tests", "src\Cellm.Tests\Cellm.Tests.csproj", "{A2E6E336-7F53-45B6-B03F-FE7681FFE8F2}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Cellm.Models", "src\Cellm.Models\Cellm.Models.shproj", "{E78A1255-A4F5-4FD1-9546-4B5677E7ED54}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -28,4 +30,8 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {44E1ACC9-691B-4A19-BAE9-2A1033F12FB0}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Cellm.Models\Cellm.Models.projitems*{ae73b93e-ab99-41b9-8367-46eefd550cb8}*SharedItemsImports = 5
src\Cellm.Models\Cellm.Models.projitems*{e78a1255-a4f5-4fd1-9546-4b5677e7ed54}*SharedItemsImports = 13
EndGlobalSection
EndGlobal
54 changes: 54 additions & 0 deletions src/Cellm.Models/Cellm.Models.projitems
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>e78a1255-a4f5-4fd1-9546-4b5677e7ed54</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>Cellm.Models</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Behaviors\CacheBehavior.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Behaviors\SentryBehavior.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Behaviors\ToolBehavior.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Client.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Exceptions\CellmModelException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Prompts\Prompt.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Prompts\PromptBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Anthropic\AnthropicConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Anthropic\AnthropicRequest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Anthropic\AnthropicRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Anthropic\AnthropicResponse.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Anthropic\Models.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\DeepSeek\DeepSeekConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\IModelRequest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\IModelRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\IModelResponse.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\IProviderConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\IProviderRequest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\IProviderRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Llamafile\LlamafileConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Mistral\MistralConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Ollama\OllamaConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Ollama\OllamaRequest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Ollama\OllamaRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Ollama\OllamaResponse.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\OpenAiCompatible\OpenAiCompatibleConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\OpenAiCompatible\OpenAiCompatibleRequest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\OpenAiCompatible\OpenAiCompatibleRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\OpenAiCompatible\OpenAiCompatibleResponse.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\OpenAi\OpenAiConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\OpenAi\OpenAiRequest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\OpenAi\OpenAiRequestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\OpenAi\OpenAiResponse.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\Provider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Providers\ProviderConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Resilience\CircuitBreakerConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Resilience\RateLimiterConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Resilience\ResiliencePipelineConfigurator.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Resilience\RetryConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Serde.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ServiceCollectionExtensions.cs" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions src/Cellm.Models/Cellm.Models.shproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>e78a1255-a4f5-4fd1-9546-4b5677e7ed54</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="Cellm.Models.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public AnthropicResponse Deserialize(AnthropicRequest request, string response)
.AddAssistantMessage(assistantMessage)
.Build();

return new AnthropicResponse(prompt);
var chatCompletion = new ChatCompletion(new ChatMessage(ChatRole.Assistant, assistantMessage));

return new AnthropicResponse(prompt, chatCompletion);
}
}
6 changes: 6 additions & 0 deletions src/Cellm.Models/Providers/Anthropic/AnthropicResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Cellm.Models.Prompts;
using Microsoft.Extensions.AI;

namespace Cellm.Models.Providers.Anthropic;

internal record AnthropicResponse(Prompt Prompt, ChatCompletion ChatCompletion) : IModelResponse;
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using Cellm.Models.Prompts;
using Microsoft.Extensions.AI;

namespace Cellm.Models;

public interface IModelResponse
{
Prompt Prompt { get; }

ChatCompletion ChatCompletion { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public async Task<OllamaResponse> Handle(OllamaRequest request, CancellationToke
.AddMessage(chatCompletion.Message)
.Build();

return new OllamaResponse(prompt);
return new OllamaResponse(prompt, chatCompletion);
}
}
6 changes: 6 additions & 0 deletions src/Cellm.Models/Providers/Ollama/OllamaResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Cellm.Models.Prompts;
using Microsoft.Extensions.AI;

namespace Cellm.Models.Providers.Ollama;

internal record OllamaResponse(Prompt Prompt, ChatCompletion ChatCompletion) : IModelResponse;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task<OpenAiResponse> Handle(OpenAiRequest request, CancellationToke
.AddMessage(chatCompletion.Message)
.Build();

return new OpenAiResponse(prompt);
return new OpenAiResponse(prompt, chatCompletion);
}

public IChatClient CreateChatClient(string modelId, string apiKey)
Expand Down
6 changes: 6 additions & 0 deletions src/Cellm.Models/Providers/OpenAi/OpenAiResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Cellm.Models.Prompts;
using Microsoft.Extensions.AI;

namespace Cellm.Models.Providers.OpenAi;

internal record OpenAiResponse(Prompt Prompt, ChatCompletion ChatCompletion) : IModelResponse;
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task<OpenAiCompatibleResponse> Handle(OpenAiCompatibleRequest reque
.AddMessage(chatCompletion.Message)
.Build();

return new OpenAiCompatibleResponse(prompt);
return new OpenAiCompatibleResponse(prompt, chatCompletion);
}

public IChatClient CreateChatClient(Uri BaseAddress, string modelId, string apiKey)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using Cellm.Models.Prompts;
using Microsoft.Extensions.AI;

namespace Cellm.Models.Providers.OpenAiCompatible;

internal record OpenAiCompatibleResponse(Prompt Prompt, ChatCompletion ChatCompletion) : IModelResponse;
File renamed without changes.
2 changes: 2 additions & 0 deletions src/Cellm/Cellm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@
</Content>
</ItemGroup>

<Import Project="..\Cellm.Models\Cellm.Models.projitems" Label="Shared" />

</Project>
5 changes: 0 additions & 5 deletions src/Cellm/Models/Providers/Anthropic/AnthropicResponse.cs

This file was deleted.

5 changes: 0 additions & 5 deletions src/Cellm/Models/Providers/Ollama/OllamaResponse.cs

This file was deleted.

5 changes: 0 additions & 5 deletions src/Cellm/Models/Providers/OpenAi/OpenAiResponse.cs

This file was deleted.

This file was deleted.