Metadata-Version: 2.1
Name: llama-index-indices-managed-postgresml
Version: 0.2.0
Summary: llama-index managed postgresml integration
License: MIT
Author: PostgresML
Author-email: team@postgresml.org
Requires-Python: >=3.8.1,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: llama-index-core (>=0.10.1,<0.11.0)
Requires-Dist: pgml (>=1.1.0,<2.0.0)
Description-Content-Type: text/markdown

# 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)
```

