This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
Is the data connector extension in llama-index supported? #166
Answered
by
SeeknnDestroy
xiaolibuzai-ovo
asked this question in
Q&A
-
there are a lot of data connector extension for llama-index, and is autollm support them? such as from database or other |
Beta Was this translation helpful? Give feedback.
Answered by
SeeknnDestroy
Nov 30, 2023
Replies: 1 comment
-
Hi @xiaolibuzai-ovo, Yes, If you prefer to use the readers implemented in llama-hub and not in our builtin readers, then you can indeed use those as well. For example for database reader, you would use the example given: from llama_index import download_loader
DatabaseReader = download_loader('DatabaseReader')
reader = DatabaseReader(
scheme = "postgresql", # Database Scheme
host = "localhost", # Database Host
port = "5432", # Database Port
user = "postgres", # Database User
password = "FakeExamplePassword", # Database Password
dbname = "postgres", # Database Name
)
query = f"""
SELECT
CONCAT(name, ' is ', age, ' years old.') AS text
FROM public.users
WHERE age >= 18
"""
documents = reader.load_data(query=query) Then you can use our from autollm AutoQueryEngine
query_engine = AutoQueryEngine.from_defaults(documents)
response = query_engine.query("your query")
print(response.response) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
SeeknnDestroy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @xiaolibuzai-ovo,
Yes, If you prefer to use the readers implemented in llama-hub and not in our builtin readers, then you can indeed use those as well. For example for database reader, you would use the example given: