Find answers from the community

Updated last year

I want to throw a custom error message

At a glance
The community member is using the LlamaIndex TypeScript package and wants to throw a custom error message if the query asked does not contain the relevant information. A comment suggests that the community member may 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.
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