semvec/pypi-packages huggingface dataset:
llama-index-readers-slack 0.4.1
llama-index readers slack integration
Requires Python: <4.0,>=3.9

# LlamaIndex Readers Integration: Slack

## Overview

The Slack Reader allows you to read conversations from Slack channels. It retrieves messages from specified channels within a given time range, if provided.

For more detailed information about the Slack Reader, visit [Slack API Home](api.slack.com).

### Installation

You can install the Slack Reader via pip:

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

### Usage

```python
from llama_index.readers.slack import (
    SlackReader,
)  # Import the SlackReader module.

# Initialize SlackReader with specified parameters.
reader = SlackReader(
    slack_token="<Slack Token>",  # Provide the Slack API token for authentication.
    earliest_date="<Earliest Date>",  # Specify the earliest date to read conversations from.
    latest_date="<Latest Date>",  # Specify the latest date to read conversations until.
)

# Load data from Slack channels using the initialized SlackReader.
documents = reader.load_data(
    channel_ids=["C04DC2VUY3F"]
)  # Specify the channel IDs to load data from.
```

This loader is designed to be used as a way to load data into
[LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently
used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.
llama-index-packs-self-rag 0.4.1
llama-index packs self rag integration
Requires Python: <4.0,>=3.9
Keywords: llm, self-RAG, smart-retreiver

# Simple self-RAG short form pack

This LlamaPack implements (\*in short form) the [self-RAG paper by Akari et al.](https://arxiv.org/pdf/2310.11511.pdf).

This paper presents a novel framework called Self-Reflective Retrieval-Augmented Generation (SELF-RAG). Which aims to enhance the quality and factuality of large language models (LLMs) by combining retrieval and self-reflection mechanisms.

The implementation is adapted from the author [implementation](https://github.com/AkariAsai/self-rag)
A full notebook guide can be found [here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/self_rag/self_rag.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 SelfRAGPack --download-dir ./self_rag_pack
```

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

## Code Usage

We will show you how to import the agent from these files!
The implementation uses llama-cpp, to download the relevant models (be sure to replace DIR_PATH)

```bash
pip3 install -q huggingface-hub
huggingface-cli download m4r1/selfrag_llama2_7b-GGUF selfrag_llama2_7b.q4_k_m.gguf --local-dir "<DIR_PATH>" --local-dir-use-symlinks False
```

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

# download and install dependencies
SelfRAGPack = download_llama_pack("SelfRAGPack", "./self_rag_pack")
```

From here, you can use the pack. You can import the relevant modules from the download folder (in the example below we assume it's a relative import or the directory
has been added to your system path).

```python
from self_rag_pack.base import SelfRAGQueryEngine

query_engine = SelfRAGQueryEngine(
    model_path=model_path, retriever=retriever, verbose=True
)

response = query_engine.query(
    "Who won best Director in the 1972 Academy Awards?"
)
```

You can also use/initialize the pack directly.

```python
from llm_compiler_agent_pack.base import SelfRAGPack

agent_pack = SelfRAGPack(
    model_path=model_path, retriever=retriever, verbose=True
)
```

The `run()` function is a light wrapper around `agent.chat()`.

```python
response = pack.run("Who won best Director in the 1972 Academy Awards?")
```
llama-index-readers-wikipedia 0.4.1
llama-index readers wikipedia integration
Requires Python: <4.0,>=3.9

# LlamaIndex Readers Integration: Wikipedia

## Overview

The Wikipedia Reader reads Wikipedia pages and retrieves their content. It allows you to specify a list of pages to read, and it retrieves the text content of each page.

### Installation

You can install the Wikipedia Reader via pip:

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

### Usage

```python
from llama_index.readers.wikipedia import WikipediaReader

# Initialize WikipediaReader
reader = WikipediaReader()

# Load data from Wikipedia
documents = reader.load_data(pages=["Page Title 1", "Page Title 2", ...])
```

This loader is designed to be used as a way to load data into
[LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently
used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.
llama-index-voice-agents-elevenlabs 0.4.1
LlamaIndex x ElevenLabs integration
Requires Python: <4.0,>=3.9

# LlamaIndex x ElevenLabs integration

This package is an integration for ElevenLabs realtime conversation with agents.

To install the package, run:

```bash
python3 -m pip install llama-index-voice-agents-elevenlabs
```

And, if you want to run it, you can refer to the simple example down here (in this case, the audio input/output are the same as the local device you are running the script on):

```python
import os

from llama_index.voice_agents.elevenlabs import ElevenLabsVoiceAgent
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs


load_dotenv()
AGENT_ID = os.environ.get("AGENT_ID")
API_KEY = os.environ.get("ELEVENLABS_API_KEY")


def main():
    client = ElevenLabs(api_key=API_KEY)
    conversation = ElevenLabsVoiceAgent(
        client,
        AGENT_ID,
        requires_auth=bool(API_KEY),
    )
    conversation.start()

    while True:
        try:
            # GET MESSAGES IN llama-index ChatMessage FORMAT
            messages = conversation.export_messages()
            events = conversation.export_events()
            # GET AVERAGE LATENCY
            latency = conversation.average_latency
        except KeyboardInterrupt:
            conversation.interrupt()
            conversation.stop()
            print(f"Messages: {messages}")
            print(f"Events: {events}")
            print(f"Latency: {latency}")


if __name__ == "__main__":
    main()
```
llama-index-readers-hatena-blog 0.4.1
llama-index readers hatena_blog integration
Requires Python: <4.0,>=3.9
Keywords: blog, hatena

# Hatena Blog Loader

```bash
pip install llama-index-readers-hatena-blog
```

This loader fetches article from your own [Hatena Blog](https://hatenablog.com/) blog posts using the AtomPub API.

You can get AtomPub info from the admin page after logging into Hatena Blog.

## Usage

Here's an example usage of the HatenaBlogReader.

```python
import os

from llama_index.readers.hatena_blog import HatenaBlogReader

root_endpoint = os.getenv("ATOM_PUB_ROOT_ENDPOINT")
api_key = os.getenv("ATOM_PUB_API_KEY")
username = os.getenv("HATENA_BLOG_USERNAME")

reader = HatenaBlogReader(
    root_endpoint=root_endpoint, api_key=api_key, username=username
)
documents = reader.load_data()
```

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

# Papers Loaders

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

## Arxiv Papers Loader

This loader fetches the text from the most relevant scientific papers on Arxiv specified by a search query (e.g. "Artificial Intelligence"). For each paper, the abstract is extracted and put in a separate document. The search query may be any string, Arxiv paper id, or a general Arxiv query string (see the full list of capabilities [here](https://info.arxiv.org/help/api/user-manual.html#query_details)).

## Usage

To use this loader, you need to pass in the search query. You may also optionally specify a local directory to temporarily store the paper PDFs (they are deleted automatically) and the maximum number of papers you want to parse for your search query (default is 10).

```python
from llama_index.readers.papers import ArxivReader

loader = ArxivReader()
documents = loader.load_data(search_query="au:Karpathy")
```

Alternatively, if you would like to load papers and abstracts separately:

```python
from llama_index.readers.papers import ArxivReader

loader = ArxivReader()
documents, abstracts = loader.load_papers_and_abstracts(
    search_query="au:Karpathy"
)
```

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/).

## Pubmed Papers Loader

This loader fetches the text from the most relevant scientific papers on Pubmed specified by a search query (e.g. "Alzheimers"). For each paper, the abstract is included in the `Document`. The search query may be any string.

## Usage

To use this loader, you need to pass in the search query. You may also optionally specify the maximum number of papers you want to parse for your search query (default is 10).

```python
from llama_index.readers.papers import PubmedReader

loader = PubmedReader()
documents = loader.load_data(search_query="amyloidosis")
```

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-nebius 0.2.1
llama-index llms Nebius AI Studio integration
Requires Python: <4.0,>=3.9

# LlamaIndex Llms Integration: [Nebius AI Studio](https://studio.nebius.ai/)

## Overview

Integrate with Nebius AI Studio API, which provides access to open-source state-of-the-art large language models (LLMs).

## Installation

```bash
pip install llama-index-llms-nebius
```

## Usage

### Initialization

#### With environmental variables.

```.env
NEBIUS_API_KEY=your_api_key

```

```python
from llama_index.llms.nebius import NebiusLLM

llm = NebiusLLM(model="meta-llama/Meta-Llama-3.1-70B-Instruct-fast")
```

#### Without environmental variables

```python
from llama_index.llms.nebius import NebiusLLM

llm = NebiusLLM(
    api_key="your_api_key", model="meta-llama/Meta-Llama-3.1-70B-Instruct-fast"
)
```

### Launching

#### Call `complete` with a prompt

```python
response = llm.complete("Amsterdam is the capital of ")
print(response)
```

#### Call `chat` with a list of messages

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

messages = [
    ChatMessage(role="system", content="You are a helpful AI assistant."),
    ChatMessage(
        role="user",
        content="Write a poem about a smart AI robot named Wall-e.",
    ),
]
response = llm.chat(messages)
print(response)
```

#### Stream `complete`

```python
response = llm.stream_complete("Amsterdam is the capital of ")
for r in response:
    print(r.delta, end="")
```

#### Stream `chat`

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

messages = [
    ChatMessage(role="system", content="You are a helpful AI assistant."),
    ChatMessage(
        role="user",
        content="Write a poem about a smart AI robot named Wall-e.",
    ),
]
response = llm.stream_chat(messages)
for r in response:
    print(r.delta, end="")
```
llama-index-postprocessor-alibabacloud-aisearch-rerank 0.3.1
llama-index postprocessor alibabacloud_aisearch_rerank integration
Requires Python: <4.0,>=3.9

# LlamaIndex Postprocessor Integration: Alibabacloud_Aisearch_Rerank

## Installation

```bash
pip install llama-index-postprocessor-alibabacloud-aisearch-rerank
```

## Usage

For further details, please visit [ranker-api-details](https://help.aliyun.com/zh/open-search/search-platform/developer-reference/ranker-api-details).

You can specify the `endpoint` and `aisearch_api_key` in the constructor, or set the environment variables `AISEARCH_ENDPOINT` and `AISEARCH_API_KEY`.

```python
from llama_index.core.data_structs import Node
from llama_index.core.schema import NodeWithScore
from llama_index.postprocessor.alibabacloud_aisearch_rerank import (
    AlibabaCloudAISearchRerank,
)

nodes = [
    NodeWithScore(
        node=Node(id_="1", text="<text1>"),
        score=0.7,
    ),
    NodeWithScore(
        node=Node(id_="2", text="<text2>"),
        score=0.8,
    ),
    NodeWithScore(
        node=Node(id_="3", text="<text3>"),
        score=0.1,
    ),
]
reranker = AlibabaCloudAISearchRerank(top_n=2)
new_nodes = reranker.postprocess_nodes(nodes, query_str="<query>")
for node in new_nodes:
    print(f"{node.node.text[:20]}\t{node.score}")
```
llama-index-tools-weather 0.4.1
llama-index tools weather integration
Requires Python: <4.0,>=3.9

# Open Weather Map Tool

This tool connects to the [OpenWeatherMap](https://openweathermap.org/api)'s OneCall API, using the `pyowm` Python package. You must initialize the tool with your OpenWeatherMap API token

The tool has access to the following functions:

- the current weather
- the weather tomorrow

## Usage

Here's an example usage of the OpenWeatherMapToolSpec.

```python
from llama_index.tools.weather import OpenWeatherMapToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

tool_spec = OpenWeatherMapToolSpec(key="...")

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

print(await agent.run("What is the temperature like in Paris?"))
print(await agent.run("What is the wind like in Budapest tomorrow?"))
```

`weather_at_location`: Use pyowm to get current weather details at a location

`forecast_tomorrow_at_location`: Use pyowm to get the forecast for tomorrow at a location.
llama-index-readers-graphql 0.4.1
llama-index readers graphql integration
Requires Python: <4.0,>=3.9
Keywords: apollo, gql, graphql

# GraphQL Loader

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

This loader loads documents via GraphQL queries from a GraphQL endpoint.
The user specifies a GraphQL endpoint URL with optional credentials to initialize the reader.
By declaring the GraphQL query and optional variables (parameters) the loader can fetch the nested result docs.

## Usage

Here's an example usage of the GraphQLReader.
You can test out queries directly [on the site](https://countries.trevorblades.com/)

```python
import os

from llama_index.readers.graphql import GraphQLReader

uri = "https://countries.trevorblades.com/"
headers = {}
query = """
    query getContinents {
        continents {
            code
            name
        }
    }
"""
reader = GraphQLReader(uri, headers)
documents = reader.query(query, variables={})
```

This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index)
and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.

It uses the [gql GraphQL library](https://pypi.org/project/gql/) for the GraphQL queries.
llama-index-tools-finance 0.4.1
llama-index finance-tools integration
Requires Python: <3.12,>=3.9

# Finance Agent Tool

This tool connects to various open finance apis and libraries to gather news, earnings information and doing fundamental analysis.

To use this tool, you'll need a few API keys:

- POLYGON_API_KEY -- <https://polygon.io/>
- FINNHUB_API_KEY -- <https://finnhub.io/>
- ALPHA_VANTAGE_API_KEY -- <https://www.alphavantage.co/>
- NEWSAPI_API_KEY -- <https://newsapi.org/>

## Installation

```
pip install llama-index-tools-finance
```

## Usage

```python
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.finance import FinanceAgentToolSpec

POLYGON_API_KEY = ""
FINNHUB_API_KEY = ""
ALPHA_VANTAGE_API_KEY = ""
NEWSAPI_API_KEY = ""
OPENAI_API_KEY = ""

GPT_MODEL_NAME = "gpt-4-0613"


def create_agent(
    polygon_api_key: str,
    finnhub_api_key: str,
    alpha_vantage_api_key: str,
    newsapi_api_key: str,
    openai_api_key: str,
) -> FunctionAgent:
    tool_spec = FinanceAgentToolSpec(
        polygon_api_key,
        finnhub_api_key,
        alpha_vantage_api_key,
        newsapi_api_key,
    )
    llm = OpenAI(temperature=0, model=GPT_MODEL_NAME, api_key=openai_api_key)
    return FunctionAgent(
        tools=tool_spec.to_tool_list(),
        llm=llm,
    )


agent = create_agent(
    POLYGON_API_KEY,
    FINNHUB_API_KEY,
    ALPHA_VANTAGE_API_KEY,
    NEWSAPI_API_KEY,
    OPENAI_API_KEY,
)

response = await agent.run(
    "What happened to AAPL stock on February 19th, 2024?"
)
```
llama-index-tools-chatgpt-plugin 0.4.1
llama-index tools chatgpt_plugin integration
Requires Python: <4.0,>=3.9

# ChatGPT Plugin Tool

This tool allows Agents to load a plugin using a ChatGPT manifest file, and have the Agent interact with it.

## 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-chatgpt-plugin/examples/chatgpt_plugin.ipynb)

```python
# Load the manifest
import requests
import yaml

f = requests.get(
    "https://raw.githubusercontent.com/sisbell/chatgpt-plugin-store/main/manifests/today-currency-converter.oiconma.repl.co.json"
).text
manifest = yaml.safe_load(f)

from llama_index.tools.chatgpt_plugin import ChatGPTPluginToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.requests import RequestsToolSpec

requests_spec = RequestsToolSpec()
plugin_spec = ChatGPTPluginToolSpec(manifest)
# OR
plugin_spec = ChatGPTPluginToolSpec(
    manifest_url="https://raw.githubusercontent.com/sisbell/chatgpt-plugin-store/main/manifests/today-currency-converter.oiconma.repl.co.json"
)

agent = FunctionAgent(
    tools=[*plugin_spec.to_tool_list(), *requests_spec.to_tool_list()],
    llm=OpenAI(model="gpt-4.1"),
)
print(await agent.run("Convert 100 euros to CAD"))
```

`describe_plugin`: Describe the plugin that has been loaded.
`load_openapi_spec`: Returns the parsed OpenAPI spec that the class was initialized with

In addition to the above method, this tool makes all of the tools available from the OpenAPI Tool Spec and Requests Tool Spec available to the agent. The plugin OpenAPI definition is loaded into the OpenAPI tool spec, and authentication headers are passed in to the Requests tool spec

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

# LlamaIndex Llms Integration: NovitaAI

### Installation

```bash
%pip install llama-index-llms-novita
```

### Select Model

Large Language Models: https://novita.ai/llm-api?utm_source=github_llama_index&utm_medium=github_readme&utm_campaign=link

### Basic usage

```py
# Import NovitaAI
from llama_index.llms.novita import NovitaAI

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

# Call complete function
response = NovitaAI(
    model="meta-llama/llama-3.1-8b-instruct", api_key=api_key
).complete("who are you")
print(response)

# Call complete with stop
response = NovitaAI(
    model="meta-llama/llama-3.1-8b-instruct", api_key=api_key
).complete(prompt="who are you", stop=["AI"])
print(response)

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

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

response = NovitaAI(
    model="meta-llama/llama-3.1-8b-instruct", api_key=api_key
).chat(messages)
print(response)
```

### Streaming: Using stream endpoint

```py
from llama_index.llms.novita import NovitaAI

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

llm = NovitaAI(model="meta-llama/llama-3.1-8b-instruct", 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 datetime import datetime
from llama_index.core.tools import FunctionTool
from llama_index.llms.novita import NovitaAI

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


def get_current_time() -> dict:
    """Get the current time"""
    return {"time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")}


llm = NovitaAI(model="deepseek/deepseek_v3", api_key=api_key)
tool = FunctionTool.from_defaults(fn=get_current_time)
response = llm.predict_and_call([tool], "What is the current time?")
print(response)
```

### NovitaAI Documentation

API Documentation: https://novita.ai/docs/guides/llm-api
llama-index-postprocessor-siliconflow-rerank 0.3.1
llama-index postprocessor siliconflow rerank integration
Requires Python: <4.0,>=3.9

# LlamaIndex Postprocessor Integration: SiliconFLow Rerank

## 1. Product Introduction

SiliconCloud provides cost-effective GenAI services based on an excellent open-source foundation model.
introduction: https://docs.siliconflow.cn/introduction

## 2. Product features

- As a one-stop cloud service platform that integrates top large models, SiliconCloud is committed to providing developers with faster, cheaper, more comprehensive, and smoother model APIs.

  - SiliconCloud has been listed on Qwen2.5-72B, DeepSeek-V2.5, Qwen2, InternLM2.5-20B-Chat, BCE, BGE, SenseVoice-Small, Llama-3.1, FLUX.1, DeepSeek-Coder-V2, SD3 Medium, GLM-4-9B-Chat, A variety of open-source large language models, image generation models, code generation models, vector and reordering models, and multimodal large models, including InstantID.

  - Among them, Qwen 2.5 (7B), Llama 3.1 (8B) and other large model APIs are free to use, so that developers and product managers do not need to worry about the computing power costs caused by the R&D stage and large-scale promotion, and realize "token freedom".

- Provide out-of-the-box large model inference acceleration services to bring a more efficient user experience to your GenAI applications.

## 3. Usage

```
import os
from llama_index.postprocessor.siliconflow_rerank import SiliconFlowRerank

reranker = SiliconFlowRerank(
    model="BAAI/bge-reranker-v2-m3",
    api_key=os.getenv("SILICONFLOW_API_KEY"),
    top_n=4,
)

nodes = [
    ...
]

response = reranker.postprocess_nodes(nodes=nodes, query_str="...")
print(response)
```
llama-index-indices-managed-postgresml 0.5.1
llama-index managed postgresml integration
Requires Python: <4.0,>=3.9

# LlamaIndex Managed Integration: PostgresML

PostgresML provides an all in one platform for production ready RAG applications.

# Setup

First, make sure you have the latest LlamaIndex version installed and a connection string to your PostgresML database.

If you don't already have a connection string, you can get one on [postgresml.org](https://postgresml.org).

```
pip install llama-index-indices-managed-postgresml
```

# Usage

Getting started is easy!

```python
import os

os.environ[
    "PGML_DATABASE_URL"
] = "..."  # Can provide in the environment or constructor later on

from llama_index.core import Document
from llama_index.indices.managed.postgresml import PostgresMLIndex

# Create an index
index = PostgresMLIndex.from_documents(
    "llama-index-test-1", [Document.example()]
)

# Connect to an index
index = PostgresMLIndex("llama-index-test-1")
```

You can use the index as a retriever

```python
# Create a retriever from an index
retriever = index.as_retriever()

results = retriever.retrieve("What managed index is the best?")
print(results)
```

You can also use the index as a query engine

```python
# Create an engine from an index
query_engine = index.as_query_engine()

response = retriever.retrieve("What managed index is the best?")
print(response)
```