https://github.com/functioncalling/functioncalling-awsbedrock
Easy to use your Swift native functions for function calling with AWSBedrock.
https://github.com/functioncalling/functioncalling-awsbedrock
aws aws-bedrock functioncalling swift
Last synced: 12 days ago
JSON representation
Easy to use your Swift native functions for function calling with AWSBedrock.
- Host: GitHub
- URL: https://github.com/functioncalling/functioncalling-awsbedrock
- Owner: FunctionCalling
- License: mit
- Created: 2024-09-16T15:27:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-04-16T22:15:41.000Z (12 days ago)
- Last Synced: 2026-04-17T00:28:57.133Z (12 days ago)
- Topics: aws, aws-bedrock, functioncalling, swift
- Language: Swift
- Homepage:
- Size: 183 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FunctionCalling-AWSBedrock
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.
## Usage
```swift
import FunctionCalling
import FunctionCalling_AWSBedrock
import AWSBedrockRuntime
// MARK: Declare the container and functions for the tools to be called from FunctionCalling.
@FunctionCalling(service: .claude)
struct MyFunctionTools {
@CallableFunction
/// Get the current stock price for a given ticker symbol
///
/// - Parameter: The stock ticker symbol, e.g. AMZN for Google Inc.
func getStockPrice(ticker: String) async throws -> String {
// code to return stock price of passed ticker
}
}
// MARK: You can directly pass the tools generated from objects to the model in Bedrock.
let client = try BedrockRuntimeClient(region: "us-east-1")
let input = ConverseInput(toolConfig: .init(tools: MyFunctionTools().bedrockAllTools))
try await client.converse(input: input)
```
## Installation
### Swift Package Manager
```
let package = Package(
name: "MyPackage",
products: [...],
targets: [
.target(
"YouAppModule",
dependencies: [
.product(name: "FunctionCalling-AWSBedrock", package: "FunctionCalling-AWSBedrock")
]
)
],
dependencies: [
.package(url: "https://github.com/FunctionCalling/FunctionCalling-AWSBedrock", from: "0.1.0")
]
)
```
## Contributing
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.
## License
The MIT License