Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

response = index.query(prompt) AttributeError: 'function' object has no attribute 'query' #2

Open
hildaoblivion opened this issue Apr 13, 2023 · 1 comment

Comments

@hildaoblivion
Copy link

Hi Tim - love the logic behind this LLama Chatgpt linkage.
Ive created the project and code but when I run I get the following error

response = index.query(prompt)
AttributeError: 'function' object has no attribute 'query'

Its pointing to this part in the code

while True:
prompt = input("Type prompt...")
response = index.query(prompt)
print(response)

Im guessing either Ive missed an install in the environment on my side or Im calling the llama function wrong (but the code is just copied over with credentials and googdoc ID changed).

Any ideas who to get past it?

S

@shrimpy-the-strange
Copy link

Could you give a try to this? It worked for me:

query_engine = index.as_query_engine()
while True:
prompt = input("Type prompt: ")
response = query_engine.query(prompt)
print(response)

Source: https://gpt-index.readthedocs.io/en/latest/guides/primer/usage_pattern.html#optional-save-the-index-for-future-use -> 5. Query the index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants