Skip to content

Commit

Permalink
docs: Fixed README.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Oct 28, 2024
1 parent 7559ea3 commit 424b209
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ var response = await client.CreateMessageAsync(
```

### Tools
using CSharpToJsonSchema;

```csharp
public enum Unit
{
Expand All @@ -44,7 +46,7 @@ public class Weather
public string Description { get; set; } = string.Empty;
}

[AnthropicTools]
[GenerateJsonSchema]
public interface IWeatherFunctions
{
[Description("Get the current weather in a given location")]
Expand Down Expand Up @@ -87,14 +89,14 @@ public class WeatherService : IWeatherFunctions
```csharp
using Anthropic;

using var api = new AnthropicClient(apiKey);
using var client = new AnthropicClient(apiKey);

var service = new WeatherService();
var tools = service.AsTools();

List<Message> messages = ["What is the current temperature in Dubai, UAE in Celsius?"];

var response = await api.CreateMessageAsync(
var response = await client.CreateMessageAsync(
model: CreateMessageRequestModel.Claude35Sonnet20240620,
messages: messages,
maxTokens: 300,
Expand All @@ -117,7 +119,7 @@ foreach (var toolUse in response.Content.Value2!
messages.Add(json.AsToolCall(toolUse));
}

response = await api.CreateMessageAsync(
response = await client.CreateMessageAsync(
model: CreateMessageRequestModel.Claude35Sonnet20240620,
messages: messages,
maxTokens: 300,
Expand Down

0 comments on commit 424b209

Please sign in to comment.