Skip to content

Commit 08c3fe7

Browse files
committed
update readme
1 parent b812e48 commit 08c3fe7

1 file changed

Lines changed: 60 additions & 1 deletion

File tree

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,61 @@
11
# FunctionCalling-AWSBedrock
2-
Easy to use your Swift native functions for function calling with [AWSBedrock](https://github.com/awslabs/aws-sdk-swift/tree/main).
2+
3+
This library simplifies the integration of the [FunctionCalling](https://github.com/fumito-ito/FunctionCalling) macro into [AWSBedrock](https://github.com/awslabs/aws-sdk-swift). By using this library, you can directly generate `Tool` objects from Swift native functions, which can then be specified as FunctionCalling when invoking Bedrock.
4+
5+
## Usage
6+
7+
```swift
8+
9+
import FunctionCalling
10+
import FunctionCalling_AWSBedrock
11+
import AWSBedrockRuntime
12+
13+
// MARK: Declare the container and functions for the tools to be called from FunctionCalling.
14+
15+
@FunctionCalling(service: .claude)
16+
struct MyFunctionTools {
17+
@CallableFunction
18+
/// Get the current stock price for a given ticker symbol
19+
///
20+
/// - Parameter: The stock ticker symbol, e.g. AMZN for Google Inc.
21+
func getStockPrice(ticker: String) async throws -> String {
22+
// code to return stock price of passed ticker
23+
}
24+
}
25+
26+
// MARK: You can directly pass the tools generated from objects to the model in Bedrock.
27+
28+
let client = try BedrockRuntimeClient(region: "us-east-1")
29+
let input = ConverseInput(toolConfig: .init(tools: MyFunctionTools().bedrockAllTools))
30+
try await client.converse(input: input)
31+
```
32+
33+
## Installation
34+
35+
### Swift Package Manager
36+
37+
```
38+
let package = Package(
39+
name: "MyPackage",
40+
products: [...],
41+
targets: [
42+
.target(
43+
"YouAppModule",
44+
dependencies: [
45+
.product(name: "FunctionCalling_AWSBedrock", package: "FunctionCalling_AWSBedrock")
46+
]
47+
)
48+
],
49+
dependencies: [
50+
.package(url: "https://github.com/FunctionCalling/FunctionCalling-AWSBedrock", from: "0.1.0")
51+
]
52+
)
53+
```
54+
55+
## Contributing
56+
57+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.
58+
59+
## License
60+
61+
The MIT License

0 commit comments

Comments
 (0)