Код: Выделить всё
from llama_parse import LlamaParse
from llama_index.llms.groq import Groq
from llama_parse.base import ResultType, Language
from llama_index.core.node_parser import MarkdownElementNodeParser
parser = LlamaParse(
api_key="xxx",
result_type=ResultType.MD,
language=Language.ENGLISH,
parsing_instructions="""\
The document is an exam documents. \
It contains many tables and images. \
Do not parse neither the definition, nor requirements, nor explanation sections.\
""",
)
llm = Groq(
model="llama3-8b-8192",
api_key="xxx",
)
documents = parser.load_data("path/to/file.pdf")
node_parser = MarkdownElementNodeParser(llm=llm,
summary_query_str="""
The document is a property valuation documents. \
It shows the key metrics for a property sale. \
The paper includes detailed figures like the price, the size of the property, \
the year of construction, the number of bedrooms and bathrooms. \
Answer questions using the information in this document and be precise. \
Skip lines for each bullet point. \
Answer with only one number if asked for it.""")
nodes = node_parser.get_nodes_from_documents(documents)
BadRequestError: Код ошибки: 400 - {'error': {'message ': "Не удалось
вызвать функцию. Измените запрос. Дополнительную информацию см. в разделе 'failed_generation'
.", 'type': 'invalid_request_error', 'code':
'tool_use_failed ', 'failed_generation': '\n{\n
"tool_calls": [\n {\n "id": "pending",\n "type":
"function",\n "function": {\n "name": "TableOutput"\n
},\n "parameters": {\n "table_id": "29 Jones St",\n
"table_title": "Информация о свойстве",\n "summary": "Сводка
информации о свойстве"\n }\n }\n ]\n}\n'}
Есть идеи, почему я это понял? Я пробовал много вещей, но ничего не помогло.
Подробнее здесь: https://stackoverflow.com/questions/788 ... -in-python