index = GPTSimpleVectorIndex.from_documents(file_doc)
line?@app.route("/query", methods=["GET"]) def query_index(): global index query_text = request.args.get("text", None) if query_text is None: return "No text found, please include a ?text=blah parameter in the URL", 400 query_engine = index.as_query_engine(service_context=service_context, streaming=True) def response_stream(response): def generate(): for text in response: yield text return generate return stream_with_context(response_stream(query_engine.query(query_text).response_gen))
response = graph.query( query_str=query_str, query_configs=query_configs, service_context=service_context_chatgpt )
response = graph.query( ^^^^^^^^^^^^ TypeError: BaseQueryEngine.query() got an unexpected keyword argument 'query_str'
save_to_string
has been replaced by StorageContext
. How would I save it to S3? from llama_index import StorageContext, load_index_from_storage # rebuild storage context storage_context = StorageContext.from_defaults(persist_dir="./storage") # load index index = load_index_from_storage(storage_context)
The new context does not provide any additional information, so the original answer remains the same.
so it messes it up when I try loading the response into a JSON file. Do you know how to remove this additional commentary it keeps returning?build_graph_from_documents
on them. What's the best way of doing this? I tried using the S3Reader but it, unfortunately, kept throwing an error.Error querying graph: Invalid template: Context information is below. --------------------- {context_str } ------------ ...insert prompt here... variables do not match the required input_variables: ['context_str' ]
query_str
as args when calling the graph object. For example: response = graph.query(query_str=query_str, query_configs=query_configs)
max_tokens
limit, the output still keeps getting cut off. Does anyone know what might be causing this?`llama-index
through pip?requirements.txt
:openai==0.26.5 tiktoken==0.2.0 wheel===0.38.4 langchain==0.0.94 llama-index==0.4.13
--platform=linux/x86_64
to my Dockerfile but it didn't change anything.