|
6 | 6 |
|
7 | 7 | namespace DirectorPrompt.Infrastructure.AI; |
8 | 8 |
|
9 | | -public sealed class EmbeddingService : IEmbeddingService |
| 9 | +public sealed class EmbeddingService |
| 10 | +( |
| 11 | + string provider, |
| 12 | + string endpoint, |
| 13 | + string? apiKey, |
| 14 | + string modelName, |
| 15 | + string? customHeaders = null |
| 16 | +) |
| 17 | + : IEmbeddingService |
10 | 18 | { |
11 | | - private readonly string provider; |
12 | | - private readonly string endpoint; |
13 | | - private readonly string? apiKey; |
14 | | - private readonly string modelName; |
15 | | - private readonly string? customHeaders; |
16 | | - |
17 | | - public EmbeddingService(string provider, string endpoint, string? apiKey, string modelName, string? customHeaders = null) |
18 | | - { |
19 | | - this.provider = provider; |
20 | | - this.endpoint = endpoint; |
21 | | - this.apiKey = apiKey; |
22 | | - this.modelName = modelName; |
23 | | - this.customHeaders = customHeaders; |
24 | | - } |
25 | | - |
26 | 19 | public EmbeddingService(ResolvedEmbeddingConfig config) : this(config.Provider, config.Endpoint, config.APIKey, config.ModelName, config.CustomHeaders) |
27 | 20 | { |
28 | 21 | } |
@@ -72,12 +65,12 @@ private IEmbeddingGenerator<string, Embedding<float>> CreateGenerator() |
72 | 65 | return embeddingClient.AsIEmbeddingGenerator(); |
73 | 66 | } |
74 | 67 |
|
75 | | - private OpenAIClient CreateOpenAIClient(string endpoint) |
| 68 | + private OpenAIClient CreateOpenAIClient(string endPoint) |
76 | 69 | { |
77 | 70 | OpenAIClientOptions options = new(); |
78 | 71 |
|
79 | | - if (!string.IsNullOrWhiteSpace(endpoint)) |
80 | | - options.Endpoint = new Uri(endpoint); |
| 72 | + if (!string.IsNullOrWhiteSpace(endPoint)) |
| 73 | + options.Endpoint = new Uri(endPoint); |
81 | 74 |
|
82 | 75 | CustomHeaderPipelinePolicy.ApplyToOptions(options, customHeaders); |
83 | 76 |
|
|
0 commit comments