Skip to content

Commit e560081

Browse files
committed
readme
1 parent 8f67c9a commit e560081

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
11
# Llama-index with InterSystems IRIS
22

3-
[Llama-index](https://github.com/run-llama/llama_index) with support for InterSystems IRIS
3+
[Llama-index](https://github.com/run-llama/llama_index) with support for InterSystems IRIS
4+
5+
## Install
6+
7+
```shell
8+
pip install llama-iris
9+
```
10+
11+
## Example
12+
13+
```python
14+
import os
15+
from dotenv import load_dotenv
16+
17+
from llama_index import SimpleDirectoryReader, StorageContext, ServiceContext
18+
from llama_index.indices.vector_store import VectorStoreIndex
19+
import openai
20+
21+
from llama_iris import IRISVectorStore
22+
23+
24+
load_dotenv(override=True)
25+
26+
documents = SimpleDirectoryReader("./data/paul_graham").load_data()
27+
print("Document ID:", documents[0].doc_id)
28+
29+
vector_store = IRISVectorStore.from_params(
30+
connection_string=CONNECTION_STRING,
31+
table_name="paul_graham_essay",
32+
embed_dim=1536, # openai embedding dimension
33+
)
34+
35+
storage_context = StorageContext.from_defaults(vector_store=vector_store)
36+
37+
index = VectorStoreIndex.from_documents(
38+
documents,
39+
storage_context=storage_context,
40+
show_progress=True,
41+
)
42+
query_engine = index.as_query_engine()
43+
44+
response = query_engine.query("What did the author do?")
45+
46+
import textwrap
47+
print(textwrap.fill(str(response), 100))
48+
```

0 commit comments

Comments
 (0)