Find answers from the community

Updated 10 months ago

I want to throw a custom error message

I want to throw a custom error message if the query asked does not contain the relevant information, im using typescript package of LlamaIndex
Here is my code
const index = await VectorStoreIndex.fromVectorStore(astraVS, ctx); const dynamicPrompt = createPrompt(query, LlamaContext); const retriever = await index.asRetriever({ similarityTopK: 3 }); const queryEngine = await index.asQueryEngine({ retriever }); const result = await queryEngine.query({ query: dynamicPrompt, });
L
1 comment
You probably need to either preprocess the query with an LLM call, or modify the prompt template so that the LLM responds appropriately in the query engine
Add a reply
Sign up and join the conversation on Discord