abetlen / abetlen/llama-cpp-python

How can I extract data from documents in JSON Output Format?

Đang mở
#942 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
Python
Star
10.6k
Fork
1.4k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Hello,

I cannot find how can I extract data from documents in a JSON Output Format?

Just like https://hackernoon.com/unlocking-structured-json-data-with-langchain-and-gpt-a-step-by-step-tutorial for OpenAI.

I have tried to prompt through the following lines:

```
document_query = "Crear un esquema basado en este texto: " + document[0].page_content
_input = prompt.format_prompt(question=document_query)
output = chat_model(_input.to_string())
print(output)
parsed = parser.parse(output)
texts_json.append(json.dumps(parsed.dict()).encode('utf-8').decode('unicode-escape'))
```

However I cannot get just the JSON output. I get long unparsed conversations (for example, human-assistant dialogues if I use vicuna ggml-vicuna-13b-4bit.bin).

Could somebody tell me if Llamacpp can already be used for those goals?

Thanks in advance.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.