Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] UX: handle tool misconfiguration better #983

Open
langchain4j opened this issue Apr 19, 2024 · 3 comments
Open

[FEATURE] UX: handle tool misconfiguration better #983

langchain4j opened this issue Apr 19, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request P2 High priority

Comments

@langchain4j
Copy link
Owner

langchain4j commented Apr 19, 2024

In the following case, when tools is a class, not an object, we should do a better job handling this situation.

AiServices.builder(Assistant.class)
                .tools(Tools.class)
                .build();

Exception should be thrown if (one of) the provided object(s) is a Class.

@langchain4j langchain4j added the enhancement New feature or request label Apr 19, 2024
@langchain4j langchain4j changed the title [FEATURE] UX: handle tool configuration better [FEATURE] UX: handle tool misconfiguration better Apr 19, 2024
@langchain4j langchain4j added the P2 High priority label Apr 19, 2024
@anunnakian
Copy link
Contributor

If we try to create an object when we have a Class as a parameter. Do we have to handle the following case too ?

AiServices.builder(Assistant.class)
                .tools(Tools.class, tools2, tools3)
                .build();

@langchain4j
Copy link
Owner Author

@anunnakian after a second thought, I am not sure it is a good idea to introduce another reflexion usage, I would rather just throw an exception if the provided object is a Class

@anunnakian
Copy link
Contributor

Got it! could you assign this issue to me, I'll make a PR at the end of the day

langchain4j added a commit that referenced this issue May 17, 2024
## Issue
#983

## Change
When we configure a tool by using a `Class` instance, we get an
exception because only object instances are allowed.


## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] There are no breaking changes
- [ ] I have added unit and integration tests for my change
- [ ] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] 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
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)


## Checklist for adding new model integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added my new module in the
[BOM](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-bom/pom.xml)


## Checklist for adding new embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends
from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT`
- [ ] I have added my new module in the
[BOM](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-bom/pom.xml)


## Checklist for changing existing embedding store integration
<!-- Please double-check the following points and mark them like this:
[X] -->
- [ ] I have manually verified that the
`{NameOfIntegration}EmbeddingStore` works correctly with the data
persisted using the latest released version of LangChain4j

---------

Co-authored-by: LangChain4j <langchain4j@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 High priority
Projects
None yet
Development

No branches or pull requests

2 participants