semvec/pypi-packages huggingface dataset:
llama-index-readers-zep 0.4.1
llama-index readers zep integration
Requires Python: <4.0,>=3.9.0
Keywords: memory, retriever, storage, zep

# Zep Reader

```bash
pip install llama-index-readers-zep
```

The Zep Reader returns a set of texts corresponding to a text query or embeddings retrieved from a Zep Collection.
The Reader is initialized with a Zep API URL and optionally an API key. The Reader can then be used to load data
from a Zep Document Collection.

## About Zep

Zep is a long-term memory store for LLM applications. Zep makes it simple to add relevant documents, chat history memory
and rich user data to your LLM app's prompts.

For more information about Zep and the Zep Quick Start Guide, see the [Zep documentation](https://docs.getzep.com/).

## Usage

Here's an end-to-end example usage of the ZepReader. First, we create a Zep Collection, chunk a document,
and add it to the collection.

We then wait for Zep's async embedder to embed the document chunks. Finally, we query the collection and print the
results.

```python
import time
from uuid import uuid4

from llama_index.core.node_parser import SimpleNodeParser
from llama_index.core import Document
from zep_python import ZepClient
from zep_python.document import Document as ZepDocument


from llama_index.readers.zep import ZepReader

# Create a Zep collection
zep_api_url = "http://localhost:8000"  # replace with your Zep API URL
collection_name = f"babbage{uuid4().hex}"
file = "babbages_calculating_engine.txt"

print(f"Creating collection {collection_name}")

client = ZepClient(base_url=zep_api_url, api_key="optional_api_key")
collection = client.document.add_collection(
    name=collection_name,  # required
    description="Babbage's Calculating Engine",  # optional
    metadata={"foo": "bar"},  # optional metadata
    embedding_dimensions=1536,  # this must match the model you've configured in Zep
    is_auto_embedded=True,  # use Zep's built-in embedder. Defaults to True
)

node_parser = SimpleNodeParser.from_defaults(chunk_size=250, chunk_overlap=20)

with open(file) as f:
    raw_text = f.read()

print("Splitting text into chunks and adding them to the Zep vector store.")
docs = node_parser.get_nodes_from_documents(
    [Document(text=raw_text)], show_progress=True
)

# Convert nodes to ZepDocument
zep_docs = [ZepDocument(content=d.get_content()) for d in docs]
uuids = collection.add_documents(zep_docs)
print(f"Added {len(uuids)} documents to collection {collection_name}")

print("Waiting for documents to be embedded")
while True:
    c = client.document.get_collection(collection_name)
    print(
        "Embedding status: "
        f"{c.document_embedded_count}/{c.document_count} documents embedded"
    )
    time.sleep(1)
    if c.status == "ready":
        break

query = "Was Babbage awarded a medal?"

# Using the ZepReader to load data from Zep
reader = ZepReader(api_url=zep_api_url, api_key="optional_api_key")
results = reader.load_data(
    collection_name=collection_name, query=query, top_k=3
)

print("\n\n".join([r.text for r in results]))
```
llama-index-llms-qianfan 0.4.1
llama-index llms baidu qianfan integration
Requires Python: <4.0,>=3.9

# LlamaIndex Llms Integration: Baidu Qianfan

Baidu Intelligent Cloud's Qianfan LLM Platform offers API services for all Baidu LLMs, such as ERNIE-3.5-8K and ERNIE-4.0-8K. It also provides a small number of open-source LLMs like Llama-2-70b-chat.

Before using the chat client, you need to activate the LLM service on the Qianfan LLM Platform console's [online service](https://console.bce.baidu.com/qianfan/ais/console/onlineService) page. Then, Generate an Access Key and a Secret Key in the [Security Authentication](https://console.bce.baidu.com/iam/#/iam/accesslist) page of the console.

## Installation

Install the necessary package:

```
pip install llama-index-llms-qianfan
```

## Initialization

```python
from llama_index.llms.qianfan import Qianfan

access_key = "XXX"
secret_key = "XXX"
model_name = "ERNIE-Speed-8K"
endpoint_url = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie_speed"
context_window = 8192
llm = Qianfan(access_key, secret_key, model_name, endpoint_url, context_window)
```
llama-index-readers-telegram 0.4.1
llama-index readers telegram integration
Requires Python: <4.0,>=3.9

# Telegram Loader

```bash
pip install llama-index-readers-telegram
```

This loader fetches posts/chat messages/comments from Telegram channels or chats into `Document`s.

Before working with Telegram’s API, you need to get your own API ID and hash:

1. [Login to your Telegram account](https://my.telegram.org) with the phone number of the developer account to use.
2. Click under API Development tools.
3. A Create new application window will appear. Fill in your application details. There is no need to enter any URL, and only the first two fields (App title and Short name) can currently be changed later.
4. Click on Create application at the end. Remember that your API hash is secret and Telegram won’t let you revoke it. Don’t post it anywhere!

This API ID and hash is the one used by your application, not your phone number. You can use this API ID and hash with any phone number.

## Usage

The first parameter you pass to the constructor of the TelegramReader is the session_name, and defaults to be the session name (or full path). That is, if you create a TelegramReader(session_name='anon', ...) instance and run load_data(), an `anon.session` file will be created in the working directory where you run this loader.

The Auth procedure asks for:

- Security Code
- Password

```bash
Please enter the code you received: 12345
Please enter your password: *******
(You are now logged in)
```

If the `.session` file already existed, it will not login again, so be aware of this if you move or rename the file! See [here](https://docs.telethon.dev/en/stable/index.html) for more instructions.

To use this loader, you simply need to pass in a entity name.

```python
from llama_index.readers.telegram import TelegramReader

loader = TelegramReader(
    session_name="[YOUR_SESSION_NAME]",
    api_id="[YOUR_API_ID]",
    api_hash="[YOUR_API_HASH]",
    phone_number="[YOUR_PHONE_NUMBER]",
)
documents = loader.load_data(
    entity_name="https://t.me/[ENTITY_NAME]", limit=100
)
```

## Examples

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/).
llama-index-llms-neutrino 0.4.1
llama-index llms neutrino integration
Requires Python: <4.0,>=3.9

# LlamaIndex Llms Integration: Neutrino

## Installation

To install the required packages, run:

```bash
%pip install llama-index-llms-neutrino
!pip install llama-index
```

## Setup

### Create Neutrino API Key

You can create an API key by visiting [platform.neutrinoapp.com](https://platform.neutrinoapp.com). Once you have the API key, set it as an environment variable:

```python
import os

os.environ["NEUTRINO_API_KEY"] = "<your-neutrino-api-key>"
```

## Using Your Router

A router is a collection of LLMs that you can route queries to. You can create a router in the Neutrino dashboard or use the default router, which includes all supported models. You can treat a router as a single LLM.

### Initialize Neutrino

Create an instance of the Neutrino model:

```python
from llama_index.llms.neutrino import Neutrino

llm = Neutrino(
    # api_key="<your-neutrino-api-key>",
    # router="<your-router-id>"  # Use 'default' for the default router
)
```

### Generate Completions

To generate a text completion for a prompt, use the `complete` method:

```python
response = llm.complete("In short, a Neutrino is")
print(f"Optimal model: {response.raw['model']}")
print(response)
```

### Chat Responses

To send a chat message and receive a response, create a `ChatMessage` and use the `chat` method:

```python
from llama_index.core.llms import ChatMessage

message = ChatMessage(
    role="user",
    content="Explain the difference between statically typed and dynamically typed languages.",
)

resp = llm.chat([message])
print(f"Optimal model: {resp.raw['model']}")
print(resp)
```

### Streaming Responses

To stream responses for a chat message, use the `stream_chat` method:

```python
message = ChatMessage(
    role="user", content="What is the approximate population of Mexico?"
)

resp = llm.stream_chat([message])
for i, r in enumerate(resp):
    if i == 0:
        print(f"Optimal model: {r.raw['model']}")
    print(r.delta, end="")
```

### LLM Implementation example

https://docs.llamaindex.ai/en/stable/examples/llm/neutrino/
llama-index-readers-firebase-realtimedb 0.4.1
llama-index readers firebase_realtimedb integration
Requires Python: <4.0,>=3.9
Keywords: database, firebase, realtimedb

# Firebase Realtime Database Loader

```bash
pip install llama-index-readers-firebase-realtimedb
```

This loader retrieves documents from Firebase Realtime Database. The user specifies the Firebase Realtime Database URL and, optionally, the path to a service account key file for authentication.

## Usage

Here's an example usage of the FirebaseRealtimeDatabaseReader.

```python
from llama_index.readers.firebase_realtimedb import (
    FirebaseRealtimeDatabaseReader,
)

database_url = "<database_url>"
service_account_key_path = "<service_account_key_path>"
path = "<path>"
reader = FirebaseRealtimeDatabaseReader(database_url, service_account_key_path)
documents = reader.load_data(path)
```

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/).
llama-index-tools-playwright 0.3.1
llama-index tools playwright integration
Requires Python: <4.0,>=3.9

# Playwright Browser Tool

This tool is a wrapper around the Playwright library. It allows you to navigate to a website, extract text and hyperlinks, and click on elements.

> **Warning**
> Only support async functions and playwright browser APIs.

## Installation

```
pip install llama-index-tools-playwright
```

## Setup

In order to use this tool, you need to have a async Playwright browser instance. You can hook one up by running the following code:

```python
browser = await PlaywrightToolSpec.create_async_playwright_browser(
    headless=False
)
playwright_tool = PlaywrightToolSpec.from_async_browser(browser)
```

## Usage

### Navigate to a website

```python
await playwright_tool.navigate_to("https://playwright.dev/python/docs/intro")
```

### Navigate back

```python
await playwright_tool.navigate_back()
```

### Get current page URL

```python
await playwright_tool.get_current_page()
```

### Extract all hyperlinks

```python
await playwright_tool.extract_hyperlinks()
```

### Extract all text

```python
await playwright_tool.extract_text()
```

### Get element attributes

```python
element = await playwright_tool.get_elements(
    selector="ELEMENT_SELECTOR", attributes=["innerText"]
)
```

### Click on an element

```python
await playwright_tool.click(selector="ELEMENT_SELECTOR")
```

### Fill in an input field

```python
await playwright_tool.fill(selector="ELEMENT_SELECTOR", value="Hello")
```

## Agentic Usage

This tool has a more extensive example usage documented in a Jupyter notebook [here](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-playwright/examples/playwright_browser_agent.ipynb)
llama-index-readers-athena 0.4.1
llama-index readers athena integration
Requires Python: <4.0,>=3.9
Keywords: aws athena, datalake, sql

# Athena reader.

```bash
pip install llama-index-readers-athena

pip install llama-index-llms-openai
```

Athena reader allow execute SQL with AWS Athena. We using SQLAlchemy and PyAthena under the hood.

## Permissions

WE HIGHLY RECOMMEND USING THIS LOADER WITH AWS EC2 IAM ROLE.

## Usage

Here's an example usage of the AthenaReader.

```
import os
import dotenv
from llama_index.core import SQLDatabase,ServiceContext
from llama_index.core.query_engine import NLSQLTableQueryEngine
from llama_index.llms.openai import OpenAI
from llama_index.readers.athena import AthenaReader

dotenv.load_dotenv()

AWS_REGION = os.environ['AWS_REGION']
S3_STAGING_DIR = os.environ['S3_STAGING_DIR']
DATABASE = os.environ['DATABASE']
WORKGROUP = os.environ['WORKGROUP']
TABLE = os.environ['TABLE']

llm = OpenAI(model="gpt-4",temperature=0, max_tokens=1024)

engine = AthenaReader.create_athena_engine(
    aws_region=AWS_REGION,
    s3_staging_dir=S3_STAGING_DIR,
    database=DATABASE,
    workgroup=WORKGROUP
)

service_context = ServiceContext.from_defaults(
  llm=llm
)

sql_database = SQLDatabase(engine, include_tables=[TABLE])

query_engine = NLSQLTableQueryEngine(
    sql_database=sql_database,
    tables=[TABLE],
    service_context=service_context
)
query_str = (
    "Which blocknumber has the most transactions?"
)
response = query_engine.query(query_str)
```

## Screeshot

![image](https://vultureprime-research-center.s3.ap-southeast-1.amazonaws.com/Screenshot+2566-10-07+at+17.58.45.png)
llama-index-tools-notion 0.4.1
llama-index tools notion integration
Requires Python: <4.0,>=3.9

# Notion Tool

This tool loads and updates documents from Notion. The user specifies an API token to initialize the NotionToolSpec.

## Usage

This tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-notion/examples/notion.ipynb)

Here's an example usage of the NotionToolSpec.

```python
from llama_index.tools.notion import NotionToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

tool_spec = NotionToolSpec()

agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

print(await agent.run("Append the heading 'I am legend' to the movies page"))
```

`load_data`: Loads a list of page or databases by id
`search_data`: Searches for matching pages or databases
`append_data`: Appends content to the matching page or database

This loader is designed to be used as a way to load data as a Tool in a Agent.
llama-index-readers-trello 0.4.1
llama-index readers trello integration
Requires Python: <4.0,>=3.9
Keywords: trello

# Trello Loader

```bash
pip install llama-index-readers-trello
```

This loader loads documents from Trello. The user specifies an API key and API token to initialize the TrelloReader. They then specify a board_id to
load in the corresponding Document objects representing Trello cards.

## Usage

Here's an example usage of the TrelloReader.

```python
import os

from llama_index.readers.trello import TrelloReader

reader = TrelloReader("<Trello_API_KEY>", "<Trello_API_TOKEN>")
documents = reader.load_data(board_id="<BOARD_ID>")
```

This loader is designed to be used as a way to load data into LlamaIndex and/or subsequently used as a Tool in a LangChain Agent. See here for
examples.
llama-index-readers-feedly-rss 0.4.1
llama-index readers feedly_rss integration
Requires Python: <4.0,>=3.9
Keywords: feedly, rss

# Feedly Loader

```bash
pip install llama-index-readers-feedly-rss
```

This loader fetches the entries from a list of RSS feeds subscribed in [Feedly](https://feedly.com). You must initialize the loader with your [Feedly API token](https://developer.feedly.com), and then pass the category name which you want to extract.

## Usage

```python
from llama_index.readers.feedly_rss import FeedlyRssReader

loader = feedlyRssReader(bearer_token="[YOUR_TOKEN]")
documents = loader.load_data(category_name="news", max_count=100)
```

## Dependencies

[feedly-client](https://pypi.org/project/feedly-client/)
llama-index-readers-snowflake 0.4.1
llama-index readers snowflake integration
Requires Python: <4.0,>=3.9
Keywords: data warehouse, database, snowflake, warehouse

# Snowflake Loader

```bash
pip install llama-index-readers-snowflake
```

This loader connects to Snowflake (using SQLAlchemy under the hood). The user specifies a query and extracts Document objects corresponding to the results. You can use this loader to easily connect to a database on Snowflake and pass the documents into a `GPTSQLStructStoreIndex` from LlamaIndex.

## Usage

### Option 1: Pass your own SQLAlchemy Engine object of the database connection

Here's an example usage of the SnowflakeReader.

```python
from llama_index.readers.snowflake import SnowflakeReader

reader = SnowflakeReader(
    engine=your_sqlalchemy_engine,
)

query = "SELECT * FROM your_table"

documents = reader.load_data(query=query)
```

### Option 2: Pass the required parameters to esstablish Snowflake connection

Here's an example usage of the SnowflakeReader.

```python
from llama_index.readers.snowflake import SnowflakeReader

reader = SnowflakeReader(
    account="your_account",
    user="your_user",
    password="your_password",
    database="your_database",
    schema="your_schema",
    warehouse="your_warehouse",
    role="your_role",  # Optional role setting
    proxy="http://proxusername:proxypassword@myproxy:port",  # Optional proxy setting
)

query = "SELECT * FROM your_table"

documents = reader.load_data(query=query)
```

#### Author

[Godwin Paul Vincent](https://github.com/godwin3737)

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/).
llama-index-llms-zhipuai 0.4.1
llama-index llms zhipuai integration
Requires Python: <4.0,>=3.9

# LlamaIndex Llms Integration: ZhipuAI

### Installation

```bash
%pip install llama-index-llms-zhipuai
!pip install llama-index
```

### Basic usage

```py
# Import ZhipuAI
from llama_index.llms.zhipuai import ZhipuAI

# Set your API key
api_key = "Your API KEY"

# Call complete function
response = ZhipuAI(model="glm-4", api_key=api_key).complete("who are you")
print(response)

# Output
# I am an AI assistant named ZhiPuQingYan（智谱清言）, you can call me Xiaozhi🤖, which is developed based on the language model jointly trained by Tsinghua University KEG Lab and Zhipu AI Company in 2023. My job is to provide appropriate answers and support to users' questions and requests.

# Call complete with stop
response = ZhipuAI(model="glm-4", api_key=api_key).complete(
    prompt="who are you", stop=["Zhipu"]
)
print(response)

# Output
# I am an AI assistant named ZhiPuQingYan（智谱清言）, you can call me Xiaozhi🤖, which is developed based on the language model jointly trained by Tsinghua University KEG Lab and Zhipu

# Call chat with a list of messages
from llama_index.core.llms import ChatMessage

messages = [
    ChatMessage(role="user", content="who are you"),
]

response = ZhipuAI(model="glm-4", api_key=api_key).chat(messages)
print(response)

# Output
# assistant: I am an AI assistant named ZhiPuQingYan（智谱清言）, you can call me Xiaozhi🤖, which is developed based on the language model jointly trained by Tsinghua University KEG Lab and Zhipu AI Company in 2023. My job is to provide appropriate answers and support to users' questions and requests.
```

### Streaming: Using stream endpoint

```py
from llama_index.llms.zhipuai import ZhipuAI

llm = ZhipuAI(model="glm-4", api_key=api_key)

# Using stream_complete endpoint
response = llm.stream_complete("who are you")
for r in response:
    print(r.delta, end="")

# Using stream_chat endpoint
messages = [
    ChatMessage(role="user", content="who are you"),
]

response = llm.stream_chat(messages)
for r in response:
    print(r.delta, end="")
```

### Function Calling

```py
from llama_index.llms.zhipuai import ZhipuAI

llm = ZhipuAI(model="glm-4", api_key="YOUR API KEY")
tools = [
    {
        "type": "function",
        "function": {
            "name": "query_weather",
            "description": "Query the weather of the city provided by user",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {
                        "type": "string",
                        "description": "City to query",
                    },
                },
                "required": ["city"],
            },
        },
    }
]
response = llm.complete(
    "help me to find the weather in Shanghai",
    tools=tools,
    tool_choice="auto",
)
print(llm.get_tool_calls_from_response(response))

# Output
# [ToolSelection(tool_id='call_9097928240216277928', tool_name='query_weather', tool_kwargs={'city': 'Shanghai'})]
```

### ZhipuAI Documentation

usage: https://bigmodel.cn/dev/howuse/introduction

api: https://bigmodel.cn/dev/api/normal-model/glm-4
llama-index-packs-sentence-window-retriever 0.5.1
llama-index packs sentence_window_retriever integration
Requires Python: <4.0,>=3.9
Keywords: retriever, sentence, window

# Sentence Window Retriever

This LlamaPack provides an example of our sentence window retriever.

This specific template shows the e2e process of building this. It loads
a document, chunks it up, adds surrounding context as metadata to each chunk,
and during retrieval inserts the context back into each chunk for response synthesis.

Check out the [notebook here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/sentence_window_retriever/sentence_window.ipynb).

## CLI Usage

You can download llamapacks directly using `llamaindex-cli`, which comes installed with the `llama-index` python package:

```bash
llamaindex-cli download-llamapack SentenceWindowRetrieverPack --download-dir ./sentence_window_retriever_pack
```

You can then inspect the files at `./sentence_window_retriever_pack` and use them as a template for your own project.

## Code Usage

You can download the pack to a the `./sentence_window_retriever_pack` directory:

```python
from llama_index.core.llama_pack import download_llama_pack

# download and install dependencies
SentenceWindowRetrieverPack = download_llama_pack(
    "SentenceWindowRetrieverPack", "./sentence_window_retriever_pack"
)
```

From here, you can use the pack, or inspect and modify the pack in `./sentence_window_retriever_pack`.

Then, you can set up the pack like so:

```python
# create the pack
# get documents from any data loader
sentence_window_retriever_pack = SentenceWindowRetrieverPack(
    documents,
)
```

The `run()` function is a light wrapper around `query_engine.query()`.

```python
response = sentence_window_retriever_pack.run(
    "Tell me a bout a Music celebrity."
)
```

You can also use modules individually.

```python
# get the sentence vector index
index = sentence_window_retriever_pack.sentence_index

# get the node parser
node_parser = sentence_window_retriever_pack.node_parser

# get the metadata replacement postprocessor
postprocessor = sentence_window_retriever_pack.postprocessor

# get the query engine
query_engine = sentence_window_retriever_pack.query_engine
```
llama-index-llms-palm 0.4.1
llama-index llms palm integration
Requires Python: <4.0,>=3.9

# LlamaIndex Llms Integration: Palm

## Installation

To install the required packages, run:

```bash
%pip install llama-index-llms-palm
!pip install llama-index
!pip install -q google-generativeai
```

> **Note:** If you're using Colab, the above commands will install the necessary packages. If you see a notice about updating `pip`, you can do so with:
>
> ```bash
> pip install --upgrade pip
> ```

## Setup

### Import Libraries and Configure API Key

Import the necessary libraries and configure your PaLM API key:

```python
import pprint
import google.generativeai as palm

palm_api_key = ""  # Add your API key here
palm.configure(api_key=palm_api_key)
```

### Define the Model

List and select the available models that support text generation:

```python
models = [
    m
    for m in palm.list_models()
    if "generateText" in m.supported_generation_methods
]

model = models[0].name
print(model)
```

You should see output similar to:

```
models/text-bison-001
```

### Using the PaLM LLM Abstraction

Now you can use the PaLM model to generate text. Here’s how to complete a prompt:

```python
from llama_index.llms.palm import PaLM

model = PaLM(api_key=palm_api_key)

# Example prompt
prompt = "Once upon a time in a faraway land, there lived a"
response = model.complete(prompt)
print(response)
```

### LLM Implementation example

https://docs.llamaindex.ai/en/stable/examples/llm/palm/