LlamaIndex Extra LLM
Just a simple extension for LlamaIndex for better apply some llm such as DeepSeek.
Features
- Support DeepSeek
Installation / Environment
Pytorch is needed, it is easier to install by conda if you are using local PC with GPU
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
Quick Usage
Initialize
from llama_index import VectorStoreIndex, SimpleDirectoryReader
from llama_index import ServiceContext
from llama_index_extra_llm.deepseek import DeepSeekLLM
llm = DeepSeekLLM(
model_name="deepseek-ai/deepseek-llm-7b-chat",
tokenizer_name="deepseek-ai/deepseek-llm-7b-chat",
context_window=3900,
max_new_tokens=1024,
generate_kwargs={"temperature": 0.7, "top_k": 50, "top_p": 0.95},
device_map="auto",
)
service_context = ServiceContext.from_defaults(llm=llm)
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents, service_context=service_context)
query_engine = index.as_query_engine()
Predict
prompt=DeepSeekLLM.messages2prompt(messages=[{"role": "user", "content": "Hello"}])
assistant=query_engine.query(prompt)
messages.append({"role": "assistant", "content": assistant})
For stream output
query_engine = index.as_query_engine(streaming=True, similarity_top_k=1)
prompt=DeepSeekLLM.messages2prompt(messages=[{"role": "user", "content": "Hello"}])
streaming_response=query_engine.query(prompt)
streaming_response.print_response_stream()
assistant=handle_output(generator)
messages.append({"role": "assistant", "content": assistant})
Metadata
Release files for llama-index-extra-llm 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_extra_llm-0.0.7.tar.gz | 5.2 kB | Without provenance | Details for llama_index_extra_llm-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_extra_llm-0.0.7-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for llama_index_extra_llm-0.0.7-py2.py3-none-any.whl |
Total release size: 9.9 kB
Release files / llama_index_extra_llm-0.0.7.tar.gz
| Download URL | llama_index_extra_llm-0.0.7.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e1a6361f02447bd2d4b7761de0801b3d9445c8b07f74ccd15e6b035a6ab380a
|
|
BLAKE2b-256 checksum How to use checksums |
d13930e13a475ad7f9c3f3534d5f2bd442d55c6847e33196e3ffed4aa381c5fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / llama_index_extra_llm-0.0.7-py2.py3-none-any.whl
| Download URL | llama_index_extra_llm-0.0.7-py2.py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
68633232bb48ba4e6d66b5d823769f89144a101c7bc40408e6940290fe5590fe
|
|
BLAKE2b-256 checksum How to use checksums |
b863c62e5f496225593b062224f7ceb4ebb5cbfaf18a9847c3fea934f5a4eff4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Security for llama-index-extra-llm 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.