Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Add downloadable modules #646

Merged
merged 88 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
21d88dc
wip
logan-markewich Nov 14, 2023
bddebe3
wip
logan-markewich Nov 14, 2023
e7bc16b
json
logan-markewich Nov 14, 2023
f6a56e8
update readmes
logan-markewich Nov 14, 2023
621827f
update readmes
logan-markewich Nov 14, 2023
2618c97
add zephyr query engine pack
logan-markewich Nov 16, 2023
696773e
added llama packs for llava completion
wenqiglantz-agi Nov 16, 2023
791c476
Update library.json
wenqiglantz Nov 16, 2023
9e8fa67
Merge branch 'main' into llama_packs
wenqiglantz Nov 16, 2023
095e345
Update base.py
wenqiglantz Nov 16, 2023
fb5a84a
Merge pull request #1 from wenqiglantz/llama_packs
logan-markewich Nov 16, 2023
6defe0f
Merge branch 'run-llama:main' into main
logan-markewich Nov 17, 2023
a0cd4e6
basic tests
logan-markewich Nov 17, 2023
723b518
fix gmail agent
logan-markewich Nov 17, 2023
df1fb6f
llama pack implementation, documentation, and notebook
axiomofjoy Nov 18, 2023
9911a6b
incorporate pr feedback
axiomofjoy Nov 18, 2023
6ec8d23
update readme
axiomofjoy Nov 18, 2023
a06fff6
Create streamlit_app.py
carolinefrasca Nov 19, 2023
47619bf
Create requirements.txt
carolinefrasca Nov 19, 2023
b97eaea
Create README.md
carolinefrasca Nov 19, 2023
f0997ab
Add files via upload
carolinefrasca Nov 19, 2023
b5e1608
Update README.md
carolinefrasca Nov 19, 2023
412ae3a
wip
Disiok Nov 19, 2023
b55a284
wip
Disiok Nov 19, 2023
285b84c
wip
Disiok Nov 19, 2023
25804f8
Update README.md
carolinefrasca Nov 19, 2023
32d5c6c
Update README.md
carolinefrasca Nov 19, 2023
df4e929
incorporate pr feedback
axiomofjoy Nov 20, 2023
80a8ba4
Merge pull request #2 from axiomofjoy/arize-phoenix-llama-pack
logan-markewich Nov 20, 2023
f42343b
update format
logan-markewich Nov 20, 2023
136f02d
Merge pull request #3 from carolinedlu/main
logan-markewich Nov 20, 2023
78df2a4
fix streamlit
logan-markewich Nov 20, 2023
b3fe3e3
adding deeplake's packs
AdkSarsen Nov 20, 2023
a5eb983
adding trailing lines in inits
AdkSarsen Nov 20, 2023
42eb7e6
Fix copy
carolinefrasca Nov 20, 2023
30b5924
fix copy
carolinefrasca Nov 20, 2023
49b8964
Merge pull request #6 from carolinedlu/main
logan-markewich Nov 20, 2023
6516af9
minor tweaks
logan-markewich Nov 20, 2023
7e99e3a
add library json
logan-markewich Nov 20, 2023
9f7c44b
Merge branch 'main' into deeplake_packs
logan-markewich Nov 20, 2023
c7ba7bd
Merge pull request #7 from logan-markewich/deeplake_packs
logan-markewich Nov 20, 2023
cc83e90
add redis ingest
logan-markewich Nov 20, 2023
0b70bc7
add to library
Disiok Nov 20, 2023
89ca038
Merge branch 'main' into suo/resume
logan-markewich Nov 20, 2023
3fec974
Merge pull request #4 from Disiok/suo/resume
logan-markewich Nov 20, 2023
cdda85a
tests
logan-markewich Nov 20, 2023
dfe36b1
linting
logan-markewich Nov 20, 2023
ab7ed0f
trulens packs
joshreini1 Nov 21, 2023
2959ff2
readme center title
joshreini1 Nov 21, 2023
d07b0dd
readme header
joshreini1 Nov 21, 2023
727e5ad
title
joshreini1 Nov 21, 2023
59a0705
cta in readme
joshreini1 Nov 21, 2023
e850cff
update readme to 3 pack
joshreini1 Nov 21, 2023
c4651b8
md change
joshreini1 Nov 21, 2023
c36e01e
md change to readme
joshreini1 Nov 21, 2023
4a5dc14
uncomment pip install
joshreini1 Nov 21, 2023
decd22f
linting
logan-markewich Nov 21, 2023
f234a42
linting
logan-markewich Nov 21, 2023
26bdb70
reqs
logan-markewich Nov 21, 2023
8338511
shorten readme
logan-markewich Nov 21, 2023
c341a82
add library json
logan-markewich Nov 21, 2023
44262d0
linting
logan-markewich Nov 21, 2023
7251524
linting
logan-markewich Nov 21, 2023
d20c9db
Merge pull request #8 from joshreini1/main
logan-markewich Nov 21, 2023
195f7c7
feat: OpenAI Image Generation Tool (#628)
EmanuelCampos Nov 18, 2023
88cdab0
wip
nerdai Nov 21, 2023
16f5922
first gradio chatbot up and running
nerdai Nov 21, 2023
120ec5b
streaming works
nerdai Nov 21, 2023
c75cf7c
wip
nerdai Nov 21, 2023
b62c67a
get everything working with two tools
nerdai Nov 21, 2023
74e0323
wip
nerdai Nov 21, 2023
fa193bd
wip
nerdai Nov 21, 2023
4387d3e
Merge pull request #10 from nerdai/nerdai/gradio_chatbot
logan-markewich Nov 21, 2023
b15ac2b
Add timescale vector auto retriever pack
cevian Nov 21, 2023
3d3deee
update readme
logan-markewich Nov 21, 2023
8b39a8d
update readmes
logan-markewich Nov 21, 2023
dab4f18
delay import
logan-markewich Nov 21, 2023
e80f6b8
linting
logan-markewich Nov 21, 2023
1d10463
update readme
logan-markewich Nov 21, 2023
a09bec6
Merge pull request #11 from cevian/add_timescale_vector_ar_pack
logan-markewich Nov 21, 2023
6b42afc
move folders
logan-markewich Nov 22, 2023
7c7f630
fix test
logan-markewich Nov 22, 2023
12818d3
Added voyage query engine
Liuhong99 Nov 22, 2023
321cdf7
merge main
logan-markewich Nov 22, 2023
c8861c8
linting
logan-markewich Nov 22, 2023
64cb191
linting
logan-markewich Nov 22, 2023
da2d4a9
Merge pull request #13 from voyage-ai/main
logan-markewich Nov 22, 2023
0247a10
linting
logan-markewich Nov 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Original creator**: Jesse Zhang (GH: [emptycrown](https://github.com/emptycrown), Twitter: [@thejessezhang](https://twitter.com/thejessezhang)), who courteously donated the repo to LlamaIndex!

This is a simple library of all the data loaders / readers / tools that have been created by the community. The goal is to make it extremely easy to connect large language models to a large variety of knowledge sources. These are general-purpose utilities that are meant to be used in [LlamaIndex](https://github.com/run-llama/llama_index) and [LangChain](https://github.com/hwchase17/langchain).
This is a simple library of all the data loaders / readers / tools / llama-packs that have been created by the community. The goal is to make it extremely easy to connect large language models to a large variety of knowledge sources. These are general-purpose utilities that are meant to be used in [LlamaIndex](https://github.com/run-llama/llama_index), [LangChain](https://github.com/hwchase17/langchain) and more!.

Loaders and readers allow you to easily ingest data for search and retrieval by a large language model, while tools allow the models to both read and write to third party data services and sources. Ultimately, this allows you to create your own customized data agent to intelligently work with you and your data to unlock the full capability of next level large language models.

Expand Down Expand Up @@ -93,9 +93,28 @@ index.query('Where did the author go to school?')

```

## How to add a loader or tool
## LLama-Pack Usage

Adding a loader or tool simply requires forking this repo and making a Pull Request. The Llama Hub website will update automatically. However, please keep in mind the following guidelines when making your PR.
Llama-packs can be downloaded using the `llamaindex-cli` tool that comes with `llama-index`:

```bash
llamaindex-cli download-llamapack ZephyrQueryEnginePack --download-dir ./zephyr_pack
```

Or with the `download_llama_pack` function directly:

```python
from llama_index.llama_packs import download_llama_pack

# download and install dependencies
LlavaCompletionPack = download_llama_pack(
"LlavaCompletionPack", "./llava_pack"
)
```

## How to add a loader/tool/llama-pack

Adding a loader/tool/llama-pack simply requires forking this repo and making a Pull Request. The Llama Hub website will update automatically when a new `llama-hub` release is made. However, please keep in mind the following guidelines when making your PR.

### Step 0: Setup virtual environment, install Poetry and dependencies

Expand Down Expand Up @@ -129,7 +148,7 @@ This will create an editable install of `llama-hub` in your venv.

### Step 1: Create a new directory

For loaders, create a new directory in `llama_hub`, and for tools create a directory in `llama_hub/tools` It can be nested within another, but name it something unique because the name of the directory will become the identifier for your loader (e.g. `google_docs`). Inside your new directory, create a `__init__.py` file specifying the module's public interface with `__all__`, a `base.py` file which will contain your loader implementation, and, if needed, a `requirements.txt` file to list the package dependencies of your loader. Those packages will automatically be installed when your loader is used, so no need to worry about that anymore!
For loaders, create a new directory in `llama_hub`, for tools create a directory in `llama_hub/tools`, and for llama-packs create a directory in `llama_hub/llama_packs` It can be nested within another, but name it something unique because the name of the directory will become the identifier for your loader (e.g. `google_docs`). Inside your new directory, create a `__init__.py` file specifying the module's public interface with `__all__`, a `base.py` file which will contain your loader implementation, and, if needed, a `requirements.txt` file to list the package dependencies of your loader. Those packages will automatically be installed when your loader is used, so no need to worry about that anymore!

If you'd like, you can create the new directory and files by running the following script in the `llama_hub` directory. Just remember to put your dependencies into a `requirements.txt` file.

Expand All @@ -143,7 +162,7 @@ Inside your new directory, create a `README.md` that mirrors that of the existin

### Step 3: Add your loader to the library.json file

Finally, add your loader to the `llama_hub/library.json` file (for tools, add them to the `llama_hub/tools/library.json`) so that it may be used by others. As is exemplified by the current file, add the class name of your loader or tool, along with its ID, author, etc. This file is referenced by the Llama Hub website and the download function within LlamaIndex.
Finally, add your loader to the `llama_hub/library.json` file (or for the equivilant `library.json` under `tools/` or `llama-packs/`) so that it may be used by others. As is exemplified by the current file, add the class name of your loader or tool, along with its ID, author, etc. This file is referenced by the Llama Hub website and the download function within LlamaIndex.

### Step 4: Make a Pull Request!

Expand Down
Empty file.
109 changes: 109 additions & 0 deletions llama_hub/llama_packs/arize_phoenix_query_engine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<center>
<p style="text-align:center">
<img alt="phoenix logo" src="https://storage.googleapis.com/arize-assets/phoenix/assets/phoenix-logo-light.svg" width="200"/>
<br>
<a href="https://docs.arize.com/phoenix/">Docs</a>
|
<a href="https://github.com/Arize-ai/phoenix">GitHub</a>
|
<a href="https://join.slack.com/t/arize-ai/shared_invite/zt-1px8dcmlf-fmThhDFD_V_48oU7ALan4Q">Community</a>
</p>
</center>
<h1 align="center">Arize-Phoenix LlamaPack</h1>

This LlamaPack instruments your LlamaIndex app for LLM tracing with [Phoenix](https://github.com/Arize-ai/phoenix), an open-source LLM observability library from [Arize AI](https://phoenix.arize.com/).

## CLI Usage

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

```bash
llamaindex-cli download-llamapack ArizePhoenixQueryEnginePack --download-dir ./arize_pack
```

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

## Code Usage

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

```python
from llama_index.llama_packs import download_llama_pack

# download and install dependencies
ArizePhoenixQueryEnginePack = download_llama_pack(
"ArizePhoenixQueryEnginePack", "./arize_pack"
)
```

You can then inspect the files at `./arize_pack` or continue on to use the module.


```python
import os

from llama_index.node_parser import SentenceSplitter
from llama_index.readers import SimpleWebPageReader
from tqdm.auto import tqdm
```

Configure your OpenAI API key.


```python
os.environ["OPENAI_API_KEY"] = "copy-your-openai-api-key-here"
```

Parse your documents into a list of nodes and pass to your LlamaPack. In this example, use nodes from a Paul Graham essay as input.


```python
documents = SimpleWebPageReader().load_data(
[
"https://raw.githubusercontent.com/jerryjliu/llama_index/adb054429f642cc7bbfcb66d4c232e072325eeab/examples/paul_graham_essay/data/paul_graham_essay.txt"
]
)
parser = SentenceSplitter()
nodes = parser.get_nodes_from_documents(documents)
phoenix_pack = ArizePhoenixQueryEnginePack(nodes=nodes)
```

Run a set of queries via the pack's `run` method, which delegates to the underlying query engine.


```python
queries = [
"What did Paul Graham do growing up?",
"When and how did Paul Graham's mother die?",
"What, in Paul Graham's opinion, is the most distinctive thing about YC?",
"When and how did Paul Graham meet Jessica Livingston?",
"What is Bel, and when and where was it written?",
]
for query in tqdm(queries):
print("Query")
print("=====")
print(query)
print()
response = phoenix_pack.run(query)
print("Response")
print("========")
print(response)
print()
```

View your trace data in the Phoenix UI.


```python
phoenix_session_url = phoenix_pack.get_modules()["session_url"]
print(f"Open the Phoenix UI to view your trace data: {phoenix_session_url}")
```

You can access the internals of the LlamaPack, including your Phoenix session and your query engine, via the `get_modules` method.


```python
phoenix_pack.get_modules()
```

Check out the [Phoenix documentation](https://docs.arize.com/phoenix/) for more information!
5 changes: 5 additions & 0 deletions llama_hub/llama_packs/arize_phoenix_query_engine/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from llama_hub.llama_packs.arize_phoenix_query_engine.base import (
ArizePhoenixQueryEnginePack,
)

__all__ = ["ArizePhoenixQueryEnginePack"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<center>\n",
" <p style=\"text-align:center\">\n",
" <img alt=\"phoenix logo\" src=\"https://storage.googleapis.com/arize-assets/phoenix/assets/phoenix-logo-light.svg\" width=\"200\"/>\n",
" <br>\n",
" <a href=\"https://docs.arize.com/phoenix/\">Docs</a>\n",
" |\n",
" <a href=\"https://github.com/Arize-ai/phoenix\">GitHub</a>\n",
" |\n",
" <a href=\"https://join.slack.com/t/arize-ai/shared_invite/zt-1px8dcmlf-fmThhDFD_V_48oU7ALan4Q\">Community</a>\n",
" </p>\n",
"</center>\n",
"<h1 align=\"center\">Arize-Phoenix LlamaPack</h1>\n",
"\n",
"This LlamaPack instruments your LlamaIndex app for LLM tracing with [Phoenix](https://github.com/Arize-ai/phoenix), an open-source LLM observability library from [Arize AI](https://phoenix.arize.com/)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Install and Import Dependencies"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install \"arize-phoenix[llama-index]\" llama-hub html2text"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"\n",
"from llama_hub.llama_packs.arize_phoenix_query_engine import ArizePhoenixQueryEnginePack\n",
"from llama_index.node_parser import SentenceSplitter\n",
"from llama_index.readers import SimpleWebPageReader\n",
"from tqdm.auto import tqdm"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Configure your OpenAI API key."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"os.environ[\"OPENAI_API_KEY\"] = \"copy-your-openai-api-key-here\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Parse your documents into a list of nodes and pass to your LlamaPack. In this example, use nodes from a Paul Graham essay as input."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"documents = SimpleWebPageReader().load_data(\n",
" [\n",
" \"https://raw.githubusercontent.com/jerryjliu/llama_index/adb054429f642cc7bbfcb66d4c232e072325eeab/examples/paul_graham_essay/data/paul_graham_essay.txt\"\n",
" ]\n",
")\n",
"parser = SentenceSplitter()\n",
"nodes = parser.get_nodes_from_documents(documents)\n",
"phoenix_pack = ArizePhoenixQueryEnginePack(nodes=nodes)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Run a set of queries via the pack's `run` method, which delegates to the underlying query engine."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"queries = [\n",
" \"What did Paul Graham do growing up?\",\n",
" \"When and how did Paul Graham's mother die?\",\n",
" \"What, in Paul Graham's opinion, is the most distinctive thing about YC?\",\n",
" \"When and how did Paul Graham meet Jessica Livingston?\",\n",
" \"What is Bel, and when and where was it written?\",\n",
"]\n",
"for query in tqdm(queries):\n",
" print(\"Query\")\n",
" print(\"=====\")\n",
" print(query)\n",
" print()\n",
" response = phoenix_pack.run(query)\n",
" print(\"Response\")\n",
" print(\"========\")\n",
" print(response)\n",
" print()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"View your trace data in the Phoenix UI."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"phoenix_session_url = phoenix_pack.get_modules()[\"session_url\"]\n",
"print(f\"Open the Phoenix UI to view your trace data: {phoenix_session_url}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can access the internals of the LlamaPack, including your Phoenix session and your query engine, via the `get_modules` method."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"phoenix_pack.get_modules()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Check out the [Phoenix documentation](https://docs.arize.com/phoenix/) for more information!"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "llmapps",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading