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

fix: incorrect function call handling with session in non-REPL #777

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

LifetimeMistake
Copy link
Contributor

Hello, this is quite a fascinating project you've got here!
I have this niche use-case where I'm trying to use it on commandline by manually setting the session ID with the -s and --save-session argument, but found that the model's response does not get saved if it used a function call.

I believe this is due to you calling exit_session before processing the tool results here:

aichat/src/main.rs

Lines 201 to 213 in 514a368

config.write().exit_session()?;
if need_send_tool_results(&tool_results) {
start_directive(
config,
input.merge_tool_call(output, tool_results),
code_mode,
abort_signal,
)
.await
} else {
Ok(())
}

Moving the start_directive recursion before the exit_session call seems to fix session handling and the save flag gets applied properly.

I am 99% sure this doesn't break any other functionality, but I'm not very familiar with the codebase -- Please double-check this before considering a merge. Cheers.

@sigoden sigoden changed the title fix: incorrect session handling in non-interactive mode fix: incorrect function call handling with session in non-REPL Aug 8, 2024
@sigoden sigoden merged commit 5c559f6 into sigoden:main Aug 8, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants