Skip to content

Commit de89187

Browse files
committed
fix rename
1 parent c984bc8 commit de89187

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

src/Utility/ResponseTools.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace OpenAI.Responses;
1616
/// Provides functionality to manage and execute OpenAI function tools for responses.
1717
/// </summary>
1818
//[Experimental("OPENAIMCP001")
19-
public class CallLocalAsync
19+
public class ResponseTools
2020
{
2121
private readonly Dictionary<string, MethodInfo> _methods = [];
2222
private readonly Dictionary<string, Func<string, BinaryData, Task<BinaryData>>> _mcpMethods = [];
@@ -30,7 +30,7 @@ public class CallLocalAsync
3030
/// Initializes a new instance of the ResponseTools class with an optional embedding client.
3131
/// </summary>
3232
/// <param name="client">The embedding client used for tool vectorization, or null to disable vectorization.</param>
33-
public CallLocalAsync(EmbeddingClient client = null)
33+
public ResponseTools(EmbeddingClient client = null)
3434
{
3535
_client = client;
3636
}
@@ -39,7 +39,7 @@ public CallLocalAsync(EmbeddingClient client = null)
3939
/// Initializes a new instance of the ResponseTools class with the specified tool types.
4040
/// </summary>
4141
/// <param name="tools">Additional tool types to add.</param>
42-
public CallLocalAsync(params Type[] tools) : this((EmbeddingClient)null)
42+
public ResponseTools(params Type[] tools) : this((EmbeddingClient)null)
4343
{
4444
foreach (var t in tools)
4545
AddFunctionTool(t);

tests/Utility/ResponseToolsTests.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,24 @@ public static async Task<double> MultiplyAsync(double x, double y)
4646
await Task.Delay(1); // Simulate async work
4747
return x * y;
4848
}
49-
50-
public static async Task<bool> IsGreaterThanAsync(long value1, long value2)
51-
{
52-
await Task.Delay(1); // Simulate async work
53-
return value1 > value2;
54-
}
55-
56-
public static async Task<float> DivideAsync(float numerator, float denominator)
57-
{
58-
await Task.Delay(1); // Simulate async work
59-
return numerator / denominator;
60-
}
6149

62-
public static async Task<string> ConcatWithBoolAsync(string text, bool flag)
63-
{
64-
await Task.Delay(1); // Simulate async work
65-
return $"{text}:{flag}";
66-
}
50+
public static async Task<bool> IsGreaterThanAsync(long value1, long value2)
51+
{
52+
await Task.Delay(1); // Simulate async work
53+
return value1 > value2;
54+
}
55+
56+
public static async Task<float> DivideAsync(float numerator, float denominator)
57+
{
58+
await Task.Delay(1); // Simulate async work
59+
return numerator / denominator;
60+
}
61+
62+
public static async Task<string> ConcatWithBoolAsync(string text, bool flag)
63+
{
64+
await Task.Delay(1); // Simulate async work
65+
return $"{text}:{flag}";
66+
}
6767
}
6868

6969
private Mock<EmbeddingClient> mockEmbeddingClient;
@@ -77,7 +77,7 @@ public void Setup()
7777
[Test]
7878
public void CanAddLocalTools()
7979
{
80-
var tools = new CallLocalAsync();
80+
var tools = new ResponseTools();
8181
tools.AddFunctionTools(typeof(TestTools));
8282

8383
Assert.That(tools.Tools, Has.Count.EqualTo(6));
@@ -92,7 +92,7 @@ public void CanAddLocalTools()
9292
[Test]
9393
public void CanAddLocalAsyncTools()
9494
{
95-
var tools = new CallLocalAsync();
95+
var tools = new ResponseTools();
9696
tools.AddFunctionTools(typeof(TestToolsAsync));
9797

9898
Assert.That(tools.Tools, Has.Count.EqualTo(6));
@@ -107,7 +107,7 @@ public void CanAddLocalAsyncTools()
107107
[Test]
108108
public async Task CanCallToolAsync()
109109
{
110-
var tools = new CallLocalAsync();
110+
var tools = new ResponseTools();
111111
tools.AddFunctionTools(typeof(TestTools));
112112

113113
var toolCalls = new[]
@@ -151,7 +151,7 @@ public async Task CanCallToolAsync()
151151
[Test]
152152
public async Task CanCallAsyncToolsAsync()
153153
{
154-
var tools = new CallLocalAsync();
154+
var tools = new ResponseTools();
155155
tools.AddFunctionTools(typeof(TestToolsAsync));
156156

157157
var toolCalls = new[]
@@ -195,7 +195,7 @@ public async Task CanCallAsyncToolsAsync()
195195
[Test]
196196
public void CreatesResponseOptionsWithTools()
197197
{
198-
var tools = new CallLocalAsync();
198+
var tools = new ResponseTools();
199199
tools.AddFunctionTools(typeof(TestTools));
200200

201201
var options = tools.ToResponseCreationOptions();
@@ -239,7 +239,7 @@ public async Task CanFilterToolsByRelevance()
239239
It.IsAny<CancellationToken>()))
240240
.ReturnsAsync(ClientResult.FromValue(embeddingCollection, mockResponse));
241241

242-
var tools = new CallLocalAsync(mockEmbeddingClient.Object);
242+
var tools = new ResponseTools(mockEmbeddingClient.Object);
243243
tools.AddFunctionTools(typeof(TestTools));
244244

245245
var options = await tools.ToResponseCreationOptionsAsync("Need to add two numbers", 1, 0.5f);
@@ -250,7 +250,7 @@ public async Task CanFilterToolsByRelevance()
250250
[Test]
251251
public async Task ReturnsErrorForNonExistentTool()
252252
{
253-
var tools = new CallLocalAsync();
253+
var tools = new ResponseTools();
254254
var toolCall = new FunctionCallResponseItem("call1", "NonExistentTool", BinaryData.FromString("{}"));
255255

256256
var result = await tools.CallAsync(toolCall);
@@ -262,7 +262,7 @@ public async Task AddMcpToolsAsync_AddsToolsCorrectly()
262262
{
263263
// Arrange
264264
var mockMcpClient = new Mock<McpClient>(new Uri("http://localhost:1234"));
265-
var tools = new CallLocalAsync();
265+
var tools = new ResponseTools();
266266

267267
var mockToolsResponse = BinaryData.FromString(@"
268268
{
@@ -340,7 +340,7 @@ public async Task CreateResponseOptions_WithMaxToolsParameter_FiltersTools()
340340
{
341341
// Arrange
342342
var mockMcpClient = new Mock<McpClient>(new Uri("http://localhost:1234"));
343-
var tools = new CallLocalAsync(mockEmbeddingClient.Object);
343+
var tools = new ResponseTools(mockEmbeddingClient.Object);
344344

345345
var mockToolsResponse = BinaryData.FromString(@"
346346
{

0 commit comments

Comments
 (0)