เคร ื่อง มือ llama - cre ate
การ ใช้
ส ร ้าง โ คร ง การ
npx create-llama@latest
✔ Which template would you like to use? › Chat
✔ Which framework would you like to use? › FastAPI (Python)
✔ Would you like to generate a NextJS frontend for your FastAPI (Python) backend? … No
✔ Which model would you like to use? › gpt-3.5-turbo-0125
✔ Which embedding model would you like to use? › text-embedding-3-small
✔ Which data source would you like to use? › Use an example PDF
✔ Would you like to add another data source? › No
✔ Would you like to use LlamaParse (improved parser for RAG - requires API key)? … yes
✔ Please provide your LlamaIndex Cloud API key (leave blank to skip): …
✔ Would you like to use a vector database? › PostgreSQL
ส ร ้าง ฐาน ข้อมูล ใน Su pa B ase และ รับ M igration connection string
เ ติ ม ไฟ ล์ . en v
เป ลี่ยน ไป ใช้ ส ภาพ แ วด ล้ อม ของ Cond as
เป ลี่ยน ไป ใช้ พร ็ อก ซี่
อ ัป เด ต เว อร์ ช ัน ของ ไล บ ร าร ี ใน ' py pro ject . tom l '
[tool]
[tool.poetry]
name = "app"
version = "0.1.0"
description = ""
authors = [ "Marcus Schiesser <mail@marcusschiesser.de>" ]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11,<3.12"
fastapi = "^0.110.1"
python-dotenv = "^1.0.0"
llama-index = "0.10.28"
llama-index-core = "0.10.28"
llama-index-agent-openai = "0.2.2"
[tool.poetry.dependencies.uvicorn]
extras = [ "standard" ]
version = "^0.29.0"
[tool.poetry.dependencies.llama-index-vector-stores-postgres]
version = "^0.1.1"
[tool.poetry.dependencies.llama-index-vector-stores-pinecone]
version = "^0.1.3"
[tool.poetry.dependencies.docx2txt]
version = "^0.8"
[build-system]
requires = [ "poetry-core" ]
build-backend = "poetry.core.masonry.api"
ผู้ จัดการ แพ ็ค เก จ
ใช้ บท ก วี แต่ บท ก วี ติด ตั้ง ม ัก จะ ใช้ ส ภาพ แ วด ล้ อม เส มือน จริง ของ บท ก วี และ มี ปัญหา ได้ ง่าย
การ ติด ตั้ง โดย ใช้ pip จะ ไม่มี ข้อ ผิด พลาด
pip install .
ส ร ้าง ด ั ชน ี
python app/engine/generate.py
มี ข้อ ผิด พลาด ในการ ใช้ text - emb edding -3 - lar ge
File "/Users/yanghaibin/anaconda3/envs/LI311-b/lib/python3.11/site-packages/pgvector/utils/__init__.py", line 35, in to_db
raise ValueError('expected %d dimensions, not %d' % (dim, len(value)))
sqlalchemy.exc.StatementError: (builtins.ValueError) expected 1536 dimensions, not 3072
การ เปลี่ยนแปลง ส ภาพ แ วด ล้ อม จะไม่ อ ัป เด ต และ จําเป็น ต้อง เปิด หน้า ต่าง บรร ท ัด คํา สั่ง ใหม่
การ ป รับ ใช้ เพื่อ การ แสดง ผล
ร ว บ รวม เก็บ ค่า เริ่ม ต้น ไว้ : poet ry install
เร ีย ก ใช้ งาน : py thonmain.py
ตัว อย่าง โ คร ง การ - ไป อ่าน : Python - Fast API
ไ ด เร ก ท อ รี แ หล ่ง ที่ มา
ต้องการ เปลี่ยน media type =" text/pla in " เป็น text/ev ent - stream
แต่ ใช้ Post man พ บ ว่า มี ปัญหา ~~~
return Stre aming Res ponse (ev ent generator (), media type =" text/pla in ")