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

Best practices for the Function return value #5

Open
ivangfr opened this issue Nov 4, 2024 · 0 comments
Open

Best practices for the Function return value #5

ivangfr opened this issue Nov 4, 2024 · 0 comments

Comments

@ivangfr
Copy link

ivangfr commented Nov 4, 2024

Hi, if you don’t mind, I'd like to ask a question here.

I'm trying to create an AI assistant. For this, I’ve created an API that the model can call. However, I’ve noticed that sometimes the assistant gets lost. I thought that maybe I should return more meaningful strings from my functions, indicating whether the response is successful or if there was an exception or an empty response.

For instance, in this bean you created:

@Bean
@Description("Change booking dates")
public Function<ChangeBookingDatesRequest, String> changeBooking() {
    return request -> {
        flightBookingService.changeBooking(request.bookingNumber(), request.firstName(), request.lastName(),
                request.date(), request.from(), request.to());
        return "";
    };
}

What if an exception occurs in changeBooking, or the request doesn’t contain enough information to change the booking? Would a more descriptive return value be helpful in such cases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant