Skip to content

Commit

Permalink
refactor: Remove MaxTokens configurations; Move CellmConfiguration to…
Browse files Browse the repository at this point in the history
… Cellm.Services.Configuration
  • Loading branch information
kaspermarstal committed Dec 2, 2024
1 parent 6e85b82 commit f1f3735
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/Cellm/AddIn/PromptArgumentParser.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Text;
using Cellm.AddIn.Exceptions;
using Cellm.Prompts;
using Cellm.Services.Configuration;
using ExcelDna.Integration;
using Microsoft.Extensions.Configuration;
using Microsoft.Office.Interop.Excel;
Expand Down
3 changes: 1 addition & 2 deletions src/Cellm/Models/Anthropic/AnthropicRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
using Cellm.AddIn;
using Cellm.AddIn.Exceptions;
using Cellm.Models.Anthropic.Models;
using Cellm.Prompts;
using Cellm.Services.Configuration;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Options;

Expand Down Expand Up @@ -56,7 +56,6 @@ public string Serialize(AnthropicRequest request)
System = request.Prompt.Messages.Where(x => x.Role == ChatRole.System).First().Text,
Messages = request.Prompt.Messages.Where(x => x.Role != ChatRole.System).Select(x => new AnthropicMessage { Content = x.Text, Role = x.Role.ToString().ToLower() }).ToList(),
Model = request.Prompt.Options.ModelId ?? _anthropicConfiguration.DefaultModel,
MaxTokens = _cellmConfiguration.MaxOutputTokens,
Temperature = request.Prompt.Options.Temperature ?? _cellmConfiguration.DefaultTemperature,
};

Expand Down
2 changes: 1 addition & 1 deletion src/Cellm/Models/Client.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Text.Json;
using Cellm.AddIn;
using Cellm.AddIn.Exceptions;
using Cellm.Models.Anthropic;
using Cellm.Models.Llamafile;
using Cellm.Models.Ollama;
using Cellm.Models.OpenAi;
using Cellm.Prompts;
using Cellm.Services.Configuration;
using MediatR;
using Microsoft.Extensions.Options;
using Polly.Timeout;
Expand Down
2 changes: 1 addition & 1 deletion src/Cellm/Models/Llamafile/LlamafileRequestHandler.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Diagnostics;
using Cellm.AddIn;
using Cellm.AddIn.Exceptions;
using Cellm.Models.Local;
using Cellm.Models.OpenAiCompatible;
using Cellm.Services.Configuration;
using MediatR;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
Expand Down
2 changes: 1 addition & 1 deletion src/Cellm/Models/ModelRequestBehavior/CachingBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using Cellm.AddIn;
using Cellm.Services.Configuration;
using MediatR;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
Expand Down
2 changes: 1 addition & 1 deletion src/Cellm/Models/ModelRequestBehavior/ToolBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Cellm.AddIn;
using Cellm.Services.Configuration;
using Cellm.Tools;
using MediatR;
using Microsoft.Extensions.AI;
Expand Down
2 changes: 1 addition & 1 deletion src/Cellm/Models/Ollama/OllamaRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
using Cellm.AddIn;
using Cellm.AddIn.Exceptions;
using Cellm.Models.Local;
using Cellm.Prompts;
using Cellm.Services.Configuration;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cellm.AddIn;
namespace Cellm.Services.Configuration;

public class CellmConfiguration
{
Expand All @@ -10,8 +10,6 @@ public class CellmConfiguration

public double DefaultTemperature { get; init; }

public int MaxOutputTokens { get; init; }

public int HttpTimeoutInSeconds { get; init; }

public int CacheTimeoutInSeconds { get; init; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Net;
using System.Threading.RateLimiting;
using Cellm.AddIn;
using Microsoft.Extensions.Configuration;
using Polly;
using Polly.CircuitBreaker;
Expand Down
1 change: 0 additions & 1 deletion src/Cellm/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"CellmConfiguration": {
"DefaultProvider": "OpenAI",
"DefaultTemperature": 0,
"MaxOutputTokens": 256,
"HttpTimeoutInSeconds": 600,
"CacheTimeoutInSeconds": 3600,
"EnableTools": true
Expand Down

0 comments on commit f1f3735

Please sign in to comment.