forked from langchain4j/langchain4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for duplicate method names in a list of tool specifications (la…
…ngchain4j#1375) ## Issue When a class has several annotated methods with `@Tools` that have the same name (but different parameters), the model does not know which one to invoke. So the idea if to check for method name duplicates and throw an exception. ## Change So now, the `toolSpecificationsFrom` method invokes a `validateSpecifications`. For now, this method only checks that there is no duplicate method names (but it could be used for other checks in the future if needed). The `validateSpecifications` method returns void if the list of tool specifications is valid. If not, it throws an `IllegalArgumentException`. ## General checklist <!-- Please double-check the following points and mark them like this: [X] --> - [x] There are no breaking changes - [x] I have added unit and integration tests for my change - [x] I have manually run all the unit and integration tests in the [core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core) and [main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j) modules, and they are all green
- Loading branch information
Showing
2 changed files
with
107 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters