Llamaindex setup
Hazırsanız işte size yol gösterecek basit bir kurulum rehberi
-
Poetry’yi kurun:
curl -sSL https://install.python-poetry.org | python3 - -
Depoyu klonlayın:
git clone https://github.com/run-llama/llama_index.git -
Proje klasörüne gidin:
cd llama_index -
Yeni bir sanal ortam oluşturun:
poetry shell -
Geliştirme bağımlılıklarını kurun:
poetry install --only dev,docs -
Çalışmak istediğiniz paketi kurun:
pip install -e llama-index-core
Son komut çalıştırıldığında aşağıdaki uyarıyı alabilirsiniz:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
llama-index 0.11.22 requires llama-index-agent-openai<0.4.0,>=0.3.4, which is not installed.
llama-index 0.11.22 requires llama-index-cli<0.4.0,>=0.3.1, which is not installed.
llama-index 0.11.22 requires llama-index-embeddings-openai<0.3.0,>=0.2.4, which is not installed.
llama-index 0.11.22 requires llama-index-indices-managed-llama-cloud>=0.3.0, which is not installed.
llama-index 0.11.22 requires llama-index-legacy<0.10.0,>=0.9.48, which is not installed.
llama-index 0.11.22 requires llama-index-llms-openai<0.3.0,>=0.2.10, which is not installed.
llama-index 0.11.22 requires llama-index-multi-modal-llms-openai<0.3.0,>=0.2.0, which is not installed.
llama-index 0.11.22 requires llama-index-program-openai<0.3.0,>=0.2.0, which is not installed.
llama-index 0.11.22 requires llama-index-question-gen-openai<0.3.0,>=0.2.0, which is not installed.
llama-index 0.11.22 requires llama-index-readers-file<0.3.0,>=0.2.0, which is not installed.
llama-index 0.11.22 requires llama-index-readers-llama-parse>=0.3.0, which is not installed.
Bu sorunu önlemek için
poetry install --only dev,docsyerinepoetry installçalıştırabilirsiniz. Alternatif olarak, bağımlılıkları manuel olarak pip ile kurabilirsiniz:
pip install llama-index-agent-openai llama-index-cli llama-index-embeddings-openai llama-index-indices-managed-llama-cloud llama-index-legacy llama-index-llms-openai llama-index-multi-modal-llms-openai llama-index-program-openai llama-index-question-gen-openai llama-index-readers-file llama-index-readers-llama-parse
Test Etme
Kurulumunuzu doğrulamak için aşağıdaki komutu çalıştırın:
from llama_index.core import SimpleDirectoryReader
Ayrıca her paketi ayrı ayrı pytest ile test edebilirsiniz. Ancak önce tree-sitter ve tree-sitter-languages paketlerini kurduğunuzdan emin olun.
Sorun Giderme
Sisteminiz eski bir Poetry sürümü kullanıyorsa, uyumluluk sorunları yaşayabilirsiniz. Bunu çözmek için mevcut Poetry sürümünüzü kontrol edin ve en son sürüme güncelleyin.
Örneğin, Ubuntu 22.04 üzerinde apt install python3-poetry komutunu çalıştırırsanız, Poetry 1.1.12 sürümü kurulur ve bu sürüm LlamaIndex ile uyumlu değildir. Uyumluluğu sağlamak için daha güncel bir Poetry sürümü kurmanız gerekir.
$ poetry shell
RuntimeError
The Poetry configuration is invalid:
- Additional properties are not allowed ('group' was unexpected)
- [source.0] Additional properties are not allowed ('priority' was unexpected)
at /usr/lib/python3/dist-packages/poetry/core/factory.py:43 in create_poetry
39│ message = ""
40│ for error in check_result["errors"]:
41│ message += " - {}\n".format(error)
42│
→ 43│ raise RuntimeError("The Poetry configuration is invalid:\n" + message)
44│
45│ # Load package
46│ name = local_config["name"]
47│ version = local_config["version"]