markdown file query
1.0.0
โครงการนี้ทำงานได้ดีที่สุดกับเอกสารภาษาอังกฤษ
โครงการนี้
.md ใด ๆ ดังนั้นมันจึงทำงานได้อย่างสมบูรณ์แบบกับแนวคิดและ Obsidian (แม้ว่าสำหรับความคิดที่คุณต้องส่งออกไปยัง .md ด้วยตนเองก่อน)langchain.textsplitterlangchain.embeddings.OpenAIEmbeddings )Pinecone--help export PINECONE_API_KEY= " your_pinecone_api_key "
export OPENAI_API_KEY= " your_openai_api_key " import os
os . environ [ "PINECONE_API_KEY" ]
os . environ [ "OPENAI_API_KEY" ]KeyError ให้รีสตาร์ทเทอร์มินัลเมื่อเสร็จสิ้น (และ IDE ของคุณหากคุณใช้งาน)git clone https://github.com/madeyexz/markdown-file-query.git pip install pinecone langchain tqdmFOLDER (หรือชื่อใด ๆ ที่คุณชอบ แต่คุณต้องเปลี่ยนรหัสตามนั้น) สังเกตว่าสิ่งนี้ควรอยู่ในไดเรกทอรีเดียวกับ main.pymain.py python3 main.py " PATH_OF_FOLDER " " QUESTION "answer.txt และ contents.txt ตามลำดับquery_only.py เพื่อหลีกเลี่ยงการฝังเอกสารอีกครั้ง python3 query_only.py " QUESTION "markdown_database ซึ่งมีไฟล์ .md พวงฉันต้องการสอบถามฐานข้อมูลนี้ด้วยคำถาม "Whats the Strange Situation" ❯ python3 main.py " markdown_database " " what's the strange situation " initiating pinecone index...
digesting docs...
uploading datas to pinecone...
92%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ | 60/65 [00:29<00:02, 1.87it/s]
let's wait for 60 seconds to avoid RateLimitError... (since im not a paid user))
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 60/60 [01:00<00:00, 1.00s/it]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 65/65 [01:32<00:00, 1.42s/it]
querying pinecone...
querying gpt...
writing results to answer.txt and contents.txt
done! the answer to 'what's the strange situation' is: '
The Strange Situation is a standardized procedure devised by Mary Ainsworth in the 1970s to observe attachment security in children within the context of caregiver relationships. It applies to infants between the age of nine and 18 months and involves a series of eight episodes lasting approximately 3 minutes each, whereby a mother, child and stranger are introduced, separated and reunited. The procedure is used to observe the quality of a young child’s attachment to his or her mother, and can also be applied to other attachment figures, such as God, through the use of Emotionally Focused Therapy (EFT) and religious beliefs, such as the saying “there are no atheists in foxholes”.'
query_only.py เพื่อหลีกเลี่ยงการฝังเอกสารอีกครั้ง ❯ python3 query_only.py " Who is Mary Ainsworth? " connecting to pinecone index...
getting docs
querying pinecone...
querying gpt...
done! the answer to 'Who is Mary Ainsworth?' is: '
Mary Ainsworth was a developmental psychologist who devised the Strange Situation in the 1970s to observe attachment security in children within the context of caregiver relationships. The Strange Situation involves a series of eight episodes lasting approximately 3 minutes each, whereby a mother, child and stranger are introduced, separated and reunited. Ainsworth is also known for her observation that if you want to see the quality of a young child’s attachment to his or her mother, watch what the child does, not when Mother leaves, but when she returns. She is also known for her research on anxious babies and their inability to use their mothers as a secure base.'
หากคุณใช้ Pinecone เมื่อใดก็ตามที่คุณต้องการสอบถามเอกสารใหม่ (เช่นการสร้างฐานข้อมูลใหม่) คุณควรสร้างดัชนี pinecone ใหม่ (สำหรับคุณไม่ต้องการคำตอบจากเอกสารเก่า) หรือลบดัชนีเก่า นี่เป็นเพราะ Pinecone ไม่รองรับการอัปเดตดัชนี (ยัง)
เพื่อลบดัชนีเก่า:
python3 delete_pinecone_index.py NAME_OF_INDEXตะโกนออกมาอย่างมากไปยังชุมชนโอเพนซอร์ซเพื่อให้ตัวอย่างตรงไปตรงมาและแบบฝึกหัดที่ครอบคลุม!