Closed aixiamomo closed 1 year ago
Hi @aixiamomo -- this is not a bug in kor, but a limitation of the LLM that you're using. Most LLMs can't parse structured data well without having some examples.
See guidelines here: https://eyurtsev.github.io/kor/guidelines.html
Closing as this is not a bug that needs to be fixed.
Hi @aixiamomo -- this is not a bug in kor, but a limitation of the LLM that you're using. Most LLMs can't parse structured data well without having some examples.
See guidelines here: https://eyurtsev.github.io/kor/guidelines.html
Closing as this is not a bug that needs to be fixed.
Thank you, I understand. Meanwhile, I have used the following code to ensure that the llms can produce output in the desired format even without examples:
from kor import prompts, examples
def _generate_examples(node):
examples_list = examples.generate_examples(node)
return examples_list if examples_list else [("", {node.id: {}})]
prompts.generate_examples = _generate_examples
{'data': {}, 'raw': '{\n "industry": "big data",\n "type": "tender",\n "deadline": "2023-08-05"\n} ', 'errors': [ParseError('The LLM has returned structured data which does not match the expected schema. Providing additional examples may help improve the parse.')],
'validated_data': {}}
the top-level object is missing