llama-index packs cohere_citation_chat integration
Project description
Cohere Citations Chat Engine Pack
Creates and runs a custom VectorStoreIndexWithCitationsChat
-- which provides the chat engine with documents/citation mode.
See the documentation here and here.
CLI Usage
You can download llamapacks directly using llamaindex-cli
, which comes installed with the llama-index
python package:
llamaindex-cli download-llamapack CohereCitationChatEnginePack --download-dir ./cohere_citation_chat_pack
You can then inspect the files at ./cohere_citation_chat_pack
and use them as a template for your own project!
You can also directly install it if you don't want to look at/inspect the source code:
pip install llama-index-packs-cohere-citation-chat
Code Usage
You can download the pack to the ./cohere_citation_chat_pack
directory:
from llama_index.readers.web import SimpleWebPageReader
from llama_index.core.llama_pack import download_llama_pack
# download and install dependencies
CohereCitationChatEnginePack = download_llama_pack(
"CohereCitationChatEnginePack", "./cohere_citation_chat_pack"
)
documents = SimpleWebPageReader().load_data(
[
"https://raw.githubusercontent.com/jerryjliu/llama_index/adb054429f642cc7bbfcb66d4c232e072325eeab/examples/paul_graham_essay/data/paul_graham_essay.txt"
]
)
cohere_citation_chat_pack = CohereCitationChatEnginePack(
documents=documents, cohere_api_key="your-api-key"
)
chat_engine = cohere_citation_chat_pack.run()
response = chat_engine.chat("What can you tell me about LLMs?")
# print chat response
print(response)
# print documents
print(response.documents)
# print citations
print(response.citations)
See the notebook on llama for a full example.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llama_index_packs_cohere_citation_chat-0.4.0.tar.gz
.
File metadata
- Download URL: llama_index_packs_cohere_citation_chat-0.4.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78453ef88233ca758c2788625155c6d72bad088b2878e908dc1afdd4853b8244 |
|
MD5 | a69bb37b221b2b82c6dc4b8d421c0869 |
|
BLAKE2b-256 | 577b0f72014392f6785436ac4020446adbe80be639f9c291f574e268f7866a67 |
File details
Details for the file llama_index_packs_cohere_citation_chat-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_packs_cohere_citation_chat-0.4.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e39ee365d778f8408f69d4f2a290c53c6f05422ad72d5bf3eb01e34e8e0f588c |
|
MD5 | 8b481b110498bd58499796d2afefe1b5 |
|
BLAKE2b-256 | d1c34b0576aeae0d147ec14567b4384c290fd41c306509a8c5d40f894db0d2e4 |