File tree Expand file tree Collapse file tree 1 file changed +33
-2
lines changed
Tests/FunctionCalling-MacPaw-OpenAITests Expand file tree Collapse file tree 1 file changed +33
-2
lines changed Original file line number Diff line number Diff line change 1
1
import Testing
2
2
@testable import FunctionCalling_MacPaw_OpenAI
3
+ import FunctionCalling
3
4
4
- @Test func example( ) async throws {
5
- // Write your test here and use APIs like `#expect(...)` to check expected conditions.
5
+ actor MacPawOpenAITests {
6
+ @FunctionCalling ( service: . claude)
7
+ struct FunctionContainer {
8
+ /// Return current weather of location that passed by the argument
9
+ /// - Parameter location: location that
10
+ /// - Returns: string of weather
11
+ @CallableFunction
12
+ func getWeather( location: String ) -> String {
13
+ return " Sunny "
14
+ }
15
+
16
+ @CallableFunction
17
+ func getStock( args: String ) -> Int {
18
+ return 0
19
+ }
20
+ }
21
+
22
+ @Test func checkConvertedResults( ) async throws {
23
+ let functions = FunctionContainer ( ) . macPawOpenAITools
24
+
25
+ #expect( functions. count == 2 )
26
+
27
+ let getWeather = try #require( functions. first? . function)
28
+ #expect( getWeather. name == " getWeather " )
29
+ #expect( getWeather. description == """
30
+ Return current weather of location that passed by the argument- Parameter location: location that- Returns: string of weather
31
+ """ )
32
+
33
+ let getStock = try #require( functions [ 1 ] . function)
34
+ #expect( getStock. name == " getStock " )
35
+ #expect( getStock. description == " " )
36
+ }
6
37
}
You can’t perform that action at this time.
0 commit comments