Skip to content

Commit 5d07cec

Browse files
committed
update meta
1 parent 38e0b2a commit 5d07cec

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2024 Fumito Ito
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,65 @@
1-
# FunctionCalling-AnthropicSwiftSDK
1+
# FunctionCalling-AnthropicSwiftSDK
2+
3+
This library simplifies the integration of the [FunctionCalling](https://github.com/fumito-ito/FunctionCalling) macro into [AnthropicSwiftSDK](https://github.com/fumito-ito/AnthropicSwiftSDK). By using this library, you can directly generate `Tool` objects from Swift native functions, which can then be specified as FunctionCalling when invoking AnthropicSwiftSDK.
4+
5+
## Usage
6+
7+
```swift
8+
9+
import FunctionCalling
10+
import FunctionCalling_AnthropicSwiftSDK
11+
import AnthropicSwiftSDK
12+
13+
// MARK: Declare the container and functions for the tools to be called from FunctionCalling.
14+
15+
@FunctionCalling(service: .claude)
16+
struct MyFunctionTools: ToolContainer {
17+
@CallableFunction
18+
/// Get the current stock price for a given ticker symbol
19+
///
20+
/// - Parameter: The stock ticker symbol, e.g. AAPL for Apple Inc.
21+
func getStockPrice(ticker: String) async throws -> String {
22+
// code to return stock price of passed ticker
23+
}
24+
}
25+
26+
27+
let result = try await Anthropic(apiKey: "your_claude_api_key")
28+
.createMessage(
29+
[message],
30+
maxTokens: 1024,
31+
tools: MyFunctionTools().anthropicSwiftTools // <= pass tool container here
32+
)
33+
```
34+
35+
## Installation
36+
37+
### Swift Package Manager
38+
39+
```
40+
let package = Package(
41+
name: "MyPackage",
42+
products: [...],
43+
targets: [
44+
.target(
45+
"YouAppModule",
46+
dependencies: [
47+
.product(name: "FunctionCalling-AnthropicSwiftSDK", package: "FunctionCalling-AnthropicSwiftSDK")
48+
]
49+
)
50+
],
51+
dependencies: [
52+
.package(url: "https://github.com/FunctionCalling/FunctionCalling-AnthropicSwiftSDK", from: "0.1.0")
53+
]
54+
)
55+
```
56+
57+
## Contributing
58+
59+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
60+
61+
Please make sure to update tests as appropriate.
62+
63+
## License
64+
65+
The MIT License

0 commit comments

Comments
 (0)