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

SQLite and Ollama bug fixes #100

Closed
wants to merge 0 commits into from
Closed

SQLite and Ollama bug fixes #100

wants to merge 0 commits into from

Conversation

TesAnti
Copy link
Collaborator

@TesAnti TesAnti commented Jan 16, 2024

No description provided.

@HavenDV
Copy link
Contributor

HavenDV commented Jan 17, 2024

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.

@TesAnti
Copy link
Collaborator Author

TesAnti commented Jan 17, 2024

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)
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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})");
Copy link
Contributor

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.

@HavenDV
Copy link
Contributor

HavenDV commented Jan 17, 2024

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

@HavenDV
Copy link
Contributor

HavenDV commented Jan 17, 2024

One test is failed: Failed Retriever_Ok

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