Conversation
Move provider specific logic into prepare_args method mostly. The only exceptions are OpenAI because it uses completely different method to call the API and TestMock which doesn't require most of the things.
Change the LLM call API to pass the list of tools to call and receive the list of tool calls. Adapt loop.metta to this change. Fix unit tests.
The historical information is still returned via HISTORY paragraph of the system prompt.
paul-v-snet
left a comment
There was a problem hiding this comment.
Other non-critical problems:
&lastresultsandLAST_SKILL_USE_RESULTShave been removed fromloop.metta, but are still described in thedocs/, e.g., here: https://github.com/vsbogd/Omega/blob/125889524b707e1ee55d12df3fa7bcf9f67c2a67/docs/reference-internals-loop.md;
Also, most of the issues found during QA in #349 still apply to this PR, so they should be addressed here as well.
Formatting errors. Get default reasoning and tokens settings from configuration.
Fixed in 1d31d57 |
| @@ -1,9 +1,204 @@ | |||
| import config | |||
| import logging | |||
There was a problem hiding this comment.
| import logging | |
| import logging | |
| import json |
|
|
||
| def set_tool(self, tool: LLMTool): | ||
| self.tool = tool | ||
|
|
There was a problem hiding this comment.
| def stringify_arguments(self): | |
| self.arguments = { | |
| name: value if isinstance(value, str) else json.dumps(value, ensure_ascii=False) | |
| for name, value in self.arguments.items() | |
| } | |
|
|
||
| def _validate_response(request: LLMRequest, response: LLMResponse) -> LLMResponse: | ||
| for call in response.calls: | ||
| if call.is_error(): |
There was a problem hiding this comment.
| if call.is_error(): | |
| call.stringify_arguments() | |
| if call.is_error(): |
There was a problem hiding this comment.
My opinion such conversion can hide issues. I don't fully understand whether it is possible for API implementor send non-string argument if type of the parameter is "string" and "strict" is True. And if it is possible we probably should consider it as a bug on the LLM provider side. I suggest wait for such issue to be reproduced before fixing it.
Co-authored-by: paul-v-snet <paul.vasiletz@singularitynet.io>
|
@vsbogd @paul-v-snet @jazzbox35 What I checked:
On every provider
I fixed items 1, 4, 5, 6, 7 and 8 and opened vsbogd/Omega#9 into this branch. Items 2 and 3 need a decision about the loop. Verdict: FAIL |
Description
This PR is part of #349 which doesn't include loop and memory changes. It delivers the most massive code change: using tools API to get the list of tool calls from LLM. It obsoletes
helper.balance_parenthesisfunction.How Has This Been Tested?
This PR doesn't introduce any code logic change just migrates existing logic to the new API. Regression testing should be enough. This PR is checked using automatic regression testing and manual smoke check with each provider.
Checklist