Commit ad2cb1a
OpenAILanguageModel + SystemLanguageModel tools calling support (#49)
* Add basic support for proper tool support response to OpenAILanguageModel
* Add support for Tool calling with Apple models
* Add "description" support for the tools parameters
* Fix ALM->FoundationModels schema conversion + empty "description" of converted DynamicGenerationSchema Property
* Fix function calling for both Chat Completion and Responses - Add the call message to the messages list
Tested with opencode.ai/zen/v1 (Chat and Responses) and generativelanguage.googleapis.com/v1beta/openai (Chat only)
* Update Sources/AnyLanguageModel/Models/OpenAILanguageModel.swift
Co-authored-by: Mattt <mattt@me.com>
* Update Sources/AnyLanguageModel/Models/OpenAILanguageModel.swift
Co-authored-by: Mattt <mattt@me.com>
* Switch to using JSONSchema to convert tools schemas to FoundationModels format
* Fix compiler warnings
* swift format -i --recursive .
* Fix OpenAI withTools() test failure
Invalid type for 'input[2].output': expected one of a string or array of objects, but got an object instead.
* Fix OpenAI tool calling logic and tests
* Refactor dynamic schema convesion to be top-level functions
* Change AnyToolWrapper APIs to be nonpublic
* Refactor call(arguments:) and make it nonpublic
* Make callFunction fileprivate
* Remove unused, private SystemLanguageModelError
* Add test coverage of dynamic schema conversion
---------
Co-authored-by: Mattt <mattt@me.com>1 parent 4c204c0 commit ad2cb1a
File tree
6 files changed
+898
-148
lines changed- Sources/AnyLanguageModel
- Models
- Tests/AnyLanguageModelTests
6 files changed
+898
-148
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
| 412 | + | |
412 | 413 | | |
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
416 | 417 | | |
417 | 418 | | |
418 | | - | |
| 419 | + | |
419 | 420 | | |
420 | 421 | | |
421 | 422 | | |
| |||
452 | 453 | | |
453 | 454 | | |
454 | 455 | | |
455 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
456 | 459 | | |
457 | 460 | | |
458 | 461 | | |
459 | 462 | | |
460 | 463 | | |
461 | 464 | | |
462 | | - | |
| 465 | + | |
463 | 466 | | |
464 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
465 | 470 | | |
466 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
467 | 474 | | |
468 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
469 | 478 | | |
470 | 479 | | |
471 | 480 | | |
| |||
0 commit comments