Skip to content

Commit 5ce1d02

Browse files
committed
fb
1 parent 76b907a commit 5ce1d02

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/Utility/ChatTools.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ChatTools
2121
private readonly Dictionary<string, Func<string, BinaryData, Task<BinaryData>>> _mcpMethods = [];
2222
private readonly List<ChatTool> _tools = [];
2323
private readonly EmbeddingClient _client;
24-
private readonly List<VectorbaseEntry> _entries = [];
24+
private readonly List<VectorDatabaseEntry> _entries = [];
2525
private readonly List<McpClient> _mcpClients = [];
2626
private readonly Dictionary<string, McpClient> _mcpClientsByEndpoint = [];
2727

@@ -133,7 +133,7 @@ private async Task AddMcpToolsAsync(BinaryData toolDefinitions, McpClient client
133133
var vector = embedding.ToFloats();
134134
var item = toolsToVectorize[embedding.Index];
135135
var toolDefinition = SerializeTool(item);
136-
_entries.Add(new VectorbaseEntry(vector, toolDefinition));
136+
_entries.Add(new VectorDatabaseEntry(vector, toolDefinition));
137137
}
138138
}
139139
}
@@ -211,7 +211,7 @@ private async Task<IEnumerable<ChatTool>> FindRelatedTools(bool async, string pr
211211
.Select(e => ParseToolDefinition(e.Data));
212212
}
213213

214-
private async Task<IEnumerable<VectorbaseEntry>> FindVectorMatches(bool async, string prompt, int maxTools, float minVectorDistance)
214+
private async Task<IEnumerable<VectorDatabaseEntry>> FindVectorMatches(bool async, string prompt, int maxTools, float minVectorDistance)
215215
{
216216
var vector = async ?
217217
await ToolsUtility.GetEmbeddingAsync(_client, prompt).ConfigureAwait(false) :

src/Utility/ResponseTools.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class ResponseTools
2121
private readonly Dictionary<string, Func<string, BinaryData, Task<BinaryData>>> _mcpMethods = [];
2222
private readonly List<ResponseTool> _tools = [];
2323
private readonly EmbeddingClient _client;
24-
private readonly List<VectorbaseEntry> _entries = [];
24+
private readonly List<VectorDatabaseEntry> _entries = [];
2525
private readonly List<McpClient> _mcpClients = [];
2626
private readonly Dictionary<string, McpClient> _mcpClientsByEndpoint = [];
2727

@@ -133,7 +133,7 @@ private async Task AddMcpToolsAsync(BinaryData toolDefinitions, McpClient client
133133
var vector = embedding.ToFloats();
134134
var item = toolsToVectorize[embedding.Index];
135135
var toolDefinition = SerializeTool(item);
136-
_entries.Add(new VectorbaseEntry(vector, toolDefinition));
136+
_entries.Add(new VectorDatabaseEntry(vector, toolDefinition));
137137
}
138138
}
139139
}
@@ -214,7 +214,7 @@ private async Task<IEnumerable<ResponseTool>> FindRelatedTools(bool async, strin
214214
.Select(e => ParseToolDefinition(e.Data));
215215
}
216216

217-
private async Task<IEnumerable<VectorbaseEntry>> FindVectorMatches(bool async, string prompt, int maxTools, float minVectorDistance)
217+
private async Task<IEnumerable<VectorDatabaseEntry>> FindVectorMatches(bool async, string prompt, int maxTools, float minVectorDistance)
218218
{
219219
var vector = async ?
220220
await ToolsUtility.GetEmbeddingAsync(_client, prompt).ConfigureAwait(false) :

src/Utility/ToolsUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ internal static void ParseFunctionCallArgs(MethodInfo method, BinaryData functio
182182
}
183183
}
184184

185-
internal static IEnumerable<VectorbaseEntry> GetClosestEntries(List<VectorbaseEntry> entries, int maxTools, float minVectorDistance, ReadOnlyMemory<float> vector)
185+
internal static IEnumerable<VectorDatabaseEntry> GetClosestEntries(List<VectorDatabaseEntry> entries, int maxTools, float minVectorDistance, ReadOnlyMemory<float> vector)
186186
{
187187
var distances = entries
188188
.Select((e, i) => (Distance: 1f - ToolsUtility.CosineSimilarity(e.Vector.Span, vector.Span), Index: i))

src/Utility/VectorBaseEntry.cs renamed to src/Utility/VectorDatabaseEntry.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
namespace OpenAI;
44

55
/// <summary>
6-
/// A vectorbase entry.
6+
/// A vector database entry.
77
/// </summary>
8-
internal readonly struct VectorbaseEntry
8+
internal readonly struct VectorDatabaseEntry
99
{
1010
/// <summary>
11-
/// Initializes a new instance of the <see cref="VectorbaseEntry"/> class.
11+
/// Initializes a new instance of the <see cref="VectorDatabaseEntry"/> class.
1212
/// </summary>
1313
/// <param name="vector"></param>
1414
/// <param name="data"></param>
1515
/// <param name="id"></param>
16-
public VectorbaseEntry(ReadOnlyMemory<float> vector, BinaryData data, int? id = default)
16+
public VectorDatabaseEntry(ReadOnlyMemory<float> vector, BinaryData data, int? id = default)
1717
{
1818
Vector = vector;
1919
Data = data;

0 commit comments

Comments
 (0)