Skip to content

Commit fe08f8f

Browse files
committed
update readme
1 parent 3186c5b commit fe08f8f

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# FunctionCalling-FirebaseVertexAI
2+
3+
This library simplifies the integration of the [FunctionCalling](https://github.com/fumito-ito/FunctionCalling) macro into [FirebaseVertexAI](https://github.com/firebase/firebase-ios-sdk/tree/main/FirebaseVertexAI). By using this library, you can directly generate `Tool` objects from Swift native functions, which can then be specified as FunctionCalling when invoking VertexAI.
4+
5+
## Usage
6+
7+
```swift
8+
9+
import FunctionCalling
10+
import FunctionCalling_FirebaseVertexAI
11+
import FirebaseVertexAI
12+
13+
// MARK: Declare the container and functions for the tools to be called from FunctionCalling.
14+
15+
@FunctionCalling(service: .llamaOrGemini)
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. GOOG 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 VertexAI.
27+
28+
let model = VertexAI.vertexAI().generativeModel(
29+
modelName: "gemini-1.5-flash",
30+
tools: MyFunctionTools().firebaseVertexAITools
31+
)
32+
```
33+
34+
## Installation
35+
36+
### Swift Package Manager
37+
38+
```
39+
let package = Package(
40+
name: "MyPackage",
41+
products: [...],
42+
targets: [
43+
.target(
44+
"YouAppModule",
45+
dependencies: [
46+
.product(name: "FunctionCalling-FirebaseVertexAI", package: "FunctionCalling-FirebaseVertexAI")
47+
]
48+
)
49+
],
50+
dependencies: [
51+
.package(url: "https://github.com/fumito-ito/FunctionCalling-FirebaseVertexAI", from: "0.1.0")
52+
]
53+
)
54+
```
55+
56+
## Contributing
57+
58+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
59+
60+
Please make sure to update tests as appropriate.
61+
62+
## License
63+
64+
The MIT License

0 commit comments

Comments
 (0)