File tree Expand file tree Collapse file tree 1 file changed +46
-1
lines changed
Expand file tree Collapse file tree 1 file changed +46
-1
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments