-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
SQLite and Ollama bug fixes #100
Conversation
will restore state little later, please push all new changes if they are again my mistake, I thought about it but forgot to write about the changes. |
just accept everything. the difference there is only empty summaties |
public async Task<string> ExecuteAsync( | ||
string? context = null, | ||
CancellationToken cancellationToken = default) | ||
public string Execute(string context=null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace to string? context = null
{ | ||
Agent.AddTools(Tools); | ||
Agent.Context = context; | ||
var chain = Chain.Set(Description, "task") | ||
| Agent; | ||
var res = await chain.Run("result").ConfigureAwait(false) ?? string.Empty; | ||
var res = chain.Run("result").Result; | ||
return res; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use .Result for async tasks. It can create problems for desktop apps.
Need to refactor method to be Async
@@ -207,10 +149,12 @@ protected override async Task<IChainValues> InternalCall(IChainValues values) | |||
} | |||
|
|||
var tool = _tools[action.Action]; | |||
var toolRes = await tool.ToolTask(action.ActionInput).ConfigureAwait(false); | |||
var toolRes = await tool.ToolTask(action.ActionInput); | |||
ActionResult(toolRes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Libraries that do not interact with the UI should use .ConfigureAwait(false) for all async methods. This will not hijack the current thread and speeds up the code.
@@ -223,6 +167,6 @@ protected override async Task<IChainValues> InternalCall(IChainValues values) | |||
} | |||
} | |||
|
|||
throw new InvalidOperationException($"Max actions exceeded({_maxActions})"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Microsoft recommends not using general exceptions. This is where InvalidOperationException comes in.
I think it's still easier for me to just move your changes to the new PR, given the changes regarding the transition to asynchronous methods when abandoning .Result as we discussed in Discord |
One test is failed: Failed Retriever_Ok |
No description provided.