semvec/pypi-packages huggingface dataset:
llama-index-packs-secgpt 0.3.1
llama-index packs - secgpt pack
Requires Python: <4.0,>=3.9

# SecGPT Pack

SecGPT is an LLM-based system that secures the execution of LLM apps via isolation. The key idea behind SecGPT is to isolate the execution of apps and to allow interaction between apps and the system only through well-defined interfaces with user permission. SecGPT can defend against multiple types of attacks, including app compromise, data stealing, inadvertent data exposure, and uncontrolled system alteration. The architecture of SecGPT is shown in the figure below. Learn more about SecGPT in our [paper](https://arxiv.org/abs/2403.04960).

<p align="center">
  <img src="https://raw.githubusercontent.com/run-llama/llama_index/main/llama-index-packs/llama-index-packs-secgpt/examples/architecture.bmp" alt="Architecture" width="400">
</p>

We develop SecGPT using [LlamaIndex](https://www.llamaindex.ai/), an open-source LLM framework. We use LlamaIndex because it supports several LLMs and apps and can be easily extended to include additional LLMs and apps. We implement SecGPT as a personal assistant chatbot, which the users can communicate with using text messages.

A comprehensive notebook guide is available [here](https://github.com/run-llama/llama_index/blob/main/llama-index-packs/llama-index-packs-secgpt/examples/SecGPT.ipynb). In the meantime, you can explore its features by comparing the execution flows of SecGPT and VanillaGPT (a non-isolated LLM-based system defined [here](https://github.com/run-llama/llama_index/blob/main/llama-index-packs/llama-index-packs-secgpt/examples/VanillaGPT.ipynb)) in response to the same query.

SecGPT original GitHub repository link: [https://github.com/llm-platform-security/SecGPT](https://github.com/llm-platform-security/SecGPT)

If you build on this work, considering citing our paper:

## Citation

```plaintext
@article{wu2024secgpt,
  title={{SecGPT: An Execution Isolation Architecture for LLM-Based Systems}},
  author={Wu, Yuhao and Roesner, Franziska and Kohno, Tadayoshi and Zhang, Ning and Iqbal, Umar},
  journal={arXiv preprint arXiv:2403.04960},
  year={2024},
}
```

## Contribution and Support

We welcome contributions to the project, e.g., through pull requests to the [original GitHub repo](https://github.com/llm-platform-security/SecGPT). Please also feel free to reach out to us if you have questions about the project and if you would like to contribute.

## Research Team

[Yuhao Wu](https://yuhao-w.github.io) (Washington University in St. Louis)
[Franziska Roesner](https://www.franziroesner.com/) (University of Washington)
[Tadayoshi Kohno](https://homes.cs.washington.edu/~yoshi/) (University of Washington)
[Ning Zhang](https://cybersecurity.seas.wustl.edu/) (Washington University in St. Louis)
[Umar Iqbal](https://umariqbal.com) (Washington University in St. Louis)
llama-index-packs-query 0.3.1
llama-index packs query integration
Requires Python: <4.0,>=3.9
Keywords: fusion, pipeline, query, rag

# RAG Fusion Pipeline Llama Pack

This LlamaPack creates the RAG Fusion Query Pipeline, which runs multiple retrievers in parallel (with varying chunk sizes), and aggregates the results in the end with reciprocal rank fusion.

You can run it out of the box, but we also encourage you to inspect the code to take a look at how our `QueryPipeline` syntax works. More details on query pipelines can be found here: https://docs.llamaindex.ai/en/stable/module_guides/querying/pipeline/root.html.

Check out our [notebook guide](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/query/rag_fusion_pipeline/rag_fusion_pipeline.ipynb) as well.

## CLI Usage

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

```bash
llamaindex-cli download-llamapack RAGFusionPipelinePack --download-dir ./rag_fusion_pipeline_pack
```

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

## Code Usage

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

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

# download and install dependencies
RAGFusionPipelinePack = download_llama_pack(
    "RAGFusionPipelinePack", "./rag_fusion_pipeline_pack"
)
```

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

Then, you can set up the pack like so:

```python
# create the pack
pack = RAGFusionPipelinePack(docs, llm=OpenAI(model="gpt-3.5-turbo"))
```

The `run()` function is a light wrapper around `query_pipeline.run(*args, **kwargs)`.

```python
response = pack.run(input="What did the author do during his time in YC?")
```

You can also use modules individually.

```python
# get query pipeline directly
pack.query_pipeline

# get retrievers for each chunk size
pack.retrievers

# get query engines for each chunk size
pack.query_engines
```
llama-index-packs-query-understanding-agent 0.3.1
llama-index packs query understanding agent integration
Requires Python: <4.0,>=3.9

# LlamaIndex Packs Integration: Query Understanding Agent

This LlamaPack implements Query Understanding Agent

Taking inspiration from Humans - when asked a query, humans would clarify what the query means before proceeding if the human sensed the query is unclear. This LlamaPack implements this.

Check out the [full notebook here](https://github.com/run-llama/llama_index/blob/main/llama-index-packs/llama-index-packs-query-understanding-agent/examples/query_understanding_agent.ipynb).

### Installation

```bash
pip install llama-index
```

## CLI Usage

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

```bash
llamaindex-cli download-llamapack QueryUnderstandingAgent --download-dir ./query_understanding_agent
```

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

## Code Usage

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

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

# download and install dependencies
QueryUnderstandingAgentPack = download_llama_pack(
    "QueryUnderstandingAgent", "./query_understanding_agent"
)

# You can use any llama-hub loader to get documents!
```

From here, you can use the pack, or inspect and modify the pack in `./query_understanding_agent`.
See example notebook for usage.
llama-index-packs-multi-document-agents 0.4.1
llama-index packs multi_document_agents integration
Requires Python: <4.0,>=3.9
Keywords: agents, document, multi

# Multi-Document Agents Pack

This LlamaPack provides an example of our multi-document agents.

This specific template shows the e2e process of building this. Given a set
of documents, the pack will build our multi-document agents architecture.

- setup a document agent over agent doc (capable of QA and summarization)
- setup a top-level agent over doc agents
- During query-time, do "tool retrieval" to return the set of relevant candidate documents, and then do retrieval within each document.

Check out the [notebook here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/multi_document_agents/multi_document_agents.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 MultiDocumentAgentsPack --download-dir ./multi_doc_agents_pack
```

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

## Code Usage

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

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

# download and install dependencies
MultiDocumentAgentsPack = download_llama_pack(
    "MultiDocumentAgentsPack", "./multi_doc_agents_pack"
)
```

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

Then, you can set up the pack like so:

```python
# imagine documents on different cities
docs = ...

doc_titles = ["Toronto", "Seattle", "Houston", "Chicago"]
doc_descriptions = [
    "<Toronto description>",
    "<Seattle description>",
    "<Houston description>",
    "<Chicago description>",
]

# create the pack
# get documents from any data loader
multi_doc_agents_pack = MultiDocumentAgentsPack(
    docs, doc_titles, doc_descriptions
)
```

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

```python
response = multi_doc_agents_pack.run(
    "Tell me the demographics of Houston, and then compare with the demographics of Chicago"
)
```

You can also use modules individually.

```python
# get the top-level agent
top_agent = multi_doc_agents_pack.top_agent

# get the object index (which indexes all document agents, can return top-k
# most relevant document agents as tools given user query)
obj_index = multi_doc_agents_pack.obj_index

# get document agents
doc_agents = multi_doc_agents_pack.agents
```
llama-index-packs-infer-retrieve-rerank 0.5.1
llama-index packs infer retrieve rerank integration
Requires Python: <4.0,>=3.9
Keywords: infer, rag, rerank, retrieve, retriever

# Infer-Retrieve-Rerank LlamaPack

This is our implementation of the paper ["In-Context Learning for Extreme Multi-Label Classification](https://arxiv.org/pdf/2401.12178.pdf) by Oosterlinck et al.

The paper proposes "infer-retrieve-rerank", a simple paradigm using frozen LLM/retriever models that can do "extreme"-label classification (the label space is huge).

1. Given a user query, use an LLM to predict an initial set of labels.
2. For each prediction, retrieve the actual label from the corpus.
3. Given the final set of labels, rerank them using an LLM.

All of these can be implemented as LlamaIndex abstractions.

A full notebook guide can be found [here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/research/infer_retrieve_rerank/infer_retrieve_rerank.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 InferRetrieveRerankPack --download-dir ./infer_retrieve_rerank_pack
```

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

## Code Usage

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

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

# download and install dependencies
InferRetrieveRerankPack = download_llama_pack(
    "InferRetrieveRerankPack", "./infer_retrieve_rerank_pack"
)
```

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

Then, you can set up the pack like so:

```python
# create the pack
pack = InferRetrieveRerankPack(
    labels,  # list of all label strings
    llm=llm,
    pred_context="<pred_context>",
    reranker_top_n=3,
    verbose=True,
)
```

The `run()` function runs predictions.

```python
pred_reactions = pack.run(inputs=[s["text"] for s in samples])
```

You can also use modules individually.

```python
# call the llm.complete()
llm = pack.llm
label_retriever = pack.label_retriever
```
llama-index-packs-gradio-react-agent-chatbot 0.3.1
llama-index packs gradio_react_agent_chatbot integration
Requires Python: <4.0,>=3.9
Keywords: chatbot, gradio, react-agent, tools

# Gradio ReActAgent Chatbot Pack

Create a ReActAgent Chatbot equipped with two LlamaHub tools, namely:
[ArxivToolSpec](https://llamahub.ai/l/tools-arxiv) and Wikipedia tool and
[WikipediaToolSpec](https://llamahub.ai/l/tools-wikipedia).

This pack's Gradio app is built using Gradio `Blocks`. User messages are submitted
via a `TextBox` Block, which are then handled by a LlamaIndex `ReActAgent` to generate a
response (calling required tools). The result is then sent to a `Chatbot` Block —
additionally the agent's thoughts are captured in an `HTML` Block.

## CLI Usage

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

```bash
llamaindex-cli download-llamapack GradioReActAgentPack --download-dir ./gradio_react_agent_chatbot
```

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

To run the app directly, use in your terminal:

```bash
export OPENAI_API_KEY="sk-...
python ./gradio_react_agent_pack/base.py
```
llama-index-packs-corrective-rag 0.3.1
llama-index packs corrective_rag paper implementation
Requires Python: <4.0,>=3.9
Keywords: corrective, corrective_rag, crag, rag, retrieve

# Corrective Retrieval Augmented Generation Llama Pack

This LlamaPack implements the Corrective Retrieval Augmented Generation (CRAG) [paper](https://arxiv.org/pdf/2401.15884.pdf)

Corrective Retrieval Augmented Generation (CRAG) is a method designed to enhance the robustness of language model generation by evaluating and augmenting the relevance of retrieved documents through a an evaluator and large-scale web searches, ensuring more accurate and reliable information is used in generation.

This LlamaPack uses [Tavily AI](https://app.tavily.com/home) API for web-searches. So, we recommend you to get the api-key before proceeding further.

### Installation

```bash
pip install llama-index llama-index-tools-tavily-research
```

## CLI Usage

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

```bash
llamaindex-cli download-llamapack CorrectiveRAGPack --download-dir ./corrective_rag_pack
```

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

## Code Usage

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

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

# download and install dependencies
CorrectiveRAGPack = download_llama_pack(
    "CorrectiveRAGPack", "./corrective_rag_pack"
)

# You can use any llama-hub loader to get documents!
corrective_rag = CorrectiveRAGPack(documents, tavily_ai_api_key)
```

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

The `run()` function contains around logic behind Corrective Retrieval Augmented Generation - [CRAG](https://arxiv.org/pdf/2401.15884.pdf) paper.

```python
response = corrective_rag.run("<query>", similarity_top_k=2)
```
llama-index-packs-agents-llm-compiler 0.3.1
llama-index packs agents llm compiler
Requires Python: <4.0,>=3.9
Keywords: agent, compiler, llm

# LLMCompiler Agent Pack

This LlamaPack implements the [LLMCompiler agent paper](https://github.com/SqueezeAILab/LLMCompiler).

A lot of code came from the source repo, we repurposed with LlamaIndex abstractions. All credits
to the original authors for a great work!

A full notebook guide can be found [here](https://github.com/run-llama/llama-hub/blob/main/llama_hub/llama_packs/agents/llm_compiler/llm_compiler.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 LLMCompilerAgentPack --download-dir ./llm_compiler_agent_pack
```

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

## Code Usage

You can download the pack to a directory. **NOTE**: You must specify `skip_load=True` - the pack contains multiple files,
which makes it hard to load directly.

We will show you how to import the agent from these files!

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

# download and install dependencies
download_llama_pack("LLMCompilerAgentPack", "./llm_compiler_agent_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
# setup pack arguments

from llama_index.core.agent import AgentRunner
from llm_compiler_agent_pack.step import LLMCompilerAgentWorker

agent_worker = LLMCompilerAgentWorker.from_tools(
    tools, llm=llm, verbose=True, callback_manager=callback_manager
)
agent = AgentRunner(agent_worker, callback_manager=callback_manager)

# start using the agent
response = agent.chat("What is (121 * 3) + 42?")
```

You can also use/initialize the pack directly.

```python
from llm_compiler_agent_pack.base import LLMCompilerAgentPack

agent_pack = LLMCompilerAgentPack(tools, llm=llm)
```

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

```python
response = pack.run("Tell me about the population of Boston")
```

You can also directly get modules from the pack.

```python
# use the agent
agent = pack.agent
response = agent.chat("task")
```
llama-index-llms-openllm 0.4.2
llama-index llms openllm integration
Requires Python: <4.0,>=3.9

# LlamaIndex LLM Integration: OpenLLM

## Installation

To install the required packages, run:

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

## Setup

### Initialize OpenLLM

First, import the necessary libraries and set up your `OpenLLM` instance. Replace `my-model`, `https://hostname.com/v1`, and `na` with your model name, API base URL, and API key, respectively:

```python
import os
from typing import List, Optional
from llama_index.llms.openllm import OpenLLM
from llama_index.core.llms import ChatMessage

llm = OpenLLM(
    model="my-model", api_base="https://hostname.com/v1", api_key="na"
)
```

## Generate Completions

To generate a completion, use the `complete` method:

```python
completion_response = llm.complete("To infinity, and")
print(completion_response)
```

### Stream Completions

You can also stream completions using the `stream_complete` method:

```python
async for it in llm.stream_complete(
    "The meaning of time is", max_new_tokens=128
):
    print(it, end="", flush=True)
```

## Chat Functionality

OpenLLM supports chat APIs, allowing you to handle conversation-like interactions. Here’s how to use it:

### Synchronous Chat

You can perform a synchronous chat by constructing a list of `ChatMessage` instances:

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

chat_messages = [
    ChatMessage(role="system", content="You are acting as Ernest Hemmingway."),
    ChatMessage(role="user", content="Hi there!"),
    ChatMessage(role="assistant", content="Yes?"),
    ChatMessage(role="user", content="What is the meaning of life?"),
]

for it in llm.chat(chat_messages):
    print(it.message.content, flush=True, end="")
```

### Asynchronous Chat

To perform an asynchronous chat, use the `astream_chat` method:

```python
async for it in llm.astream_chat(chat_messages):
    print(it.message.content, flush=True, end="")
```

### LLM Implementation example

https://docs.llamaindex.ai/en/stable/examples/llm/openllm/
global-forecasting-system 1.2.1
Global Forecasting System (GFS) Search & Download Utility
Requires Python: >=3.10

# Global Forecasting System (GFS) Search & Download Utility

[Gregory H. Halverson](https://github.com/gregory-halverson-jpl) (they/them)<br>
[gregory.h.halverson@jpl.nasa.gov](mailto:gregory.h.halverson@jpl.nasa.gov)<br>
NASA Jet Propulsion Laboratory 329G
mcp-google-email 0.1.1
MCP for GMail
Requires Python: >=3.10

# MCP Gmail Service

A Gmail service implementation using MCP (Model Control Protocol) that provides functionality for sending, receiving, and managing emails through Gmail's API.

## Features

- Email sending and receiving
- Message listing with search capabilities
- Reply to existing messages
- Today's message retrieval
- Multiple authentication methods support

## Installation

```bash
pip install mcp-gmail
```

## Usage

```python
from mcp_gmail import FastMCP

# Initialize the Gmail service
gmail_service = FastMCP("GMail")

# List unread messages
messages = gmail_service.list_message(query='is:unread', max_results=10)

# Send an email
gmail_service.send_message(
    to='recipient@example.com',
    subject='Test Email',
    message_text='Hello, this is a test email'
)

# Get today's messages
todays_messages = gmail_service.get_todays_messages(max_results=20)

# Reply to a message
gmail_service.reply_to_message(
    message_id='message_id_here',
    reply_text='Thank you for your email'
)
```

## Authentication

The package supports multiple authentication methods:
1. Service Account (via GOOGLE_APPLICATION_CREDENTIALS or GOOGLE_CREDENTIALS_CONFIG)
2. OAuth 2.0 (via credentials.json and token.json)
3. Application Default Credentials (ADC)

## Requirements

- Python 3.10+
- google-auth
- google-auth-oauthlib
- google-api-python-client
- mcp-server

## License

MIT License
ensembleswarm 1.0a3
Ensemble of ensembles regression utility
Requires Python: >=3.10

# EnsembleSwarm

[![PyPI release](https://github.com/gperdrizet/ensembleswarm/actions/workflows/publish_pypi.yml/badge.svg)](https://github.com/gperdrizet/ensembleswarm/actions/workflows/publish_pypi.yml) [![Python CI](https://github.com/gperdrizet/ensembleswarm/actions/workflows/python_ci.yml/badge.svg)](https://github.com/gperdrizet/ensembleswarm/actions/workflows/python_ci.yml)[![Devcontainer](https://github.com/gperdrizet/ensembleswarm/actions/workflows/codespaces/create_codespaces_prebuilds/badge.svg)](https://github.com/gperdrizet/ensembleswarm/actions/workflows/codespaces/create_codespaces_prebuilds)

Utility for regression on tabular data, implementing ensembles of ensembles with various SciKit-learn estimators.

## 1. Installation

Install the pre-release alpha from PyPI with:

```bash
pip install ensembleswarm
```