Stop agent from accessing information outside of K...
# support
j
Is there a way, or maybe some kind of toggle, that will prevent our agent from using information outside of its knowledge base? We have it clearly defined in the prompt not to do so, but it will occasionally go on a tangent providing information that it shouldn't. In terms of KBs, we've tried the built-in KB, Trieve and Azure AI Search, but getting the same results.
v
Hi there! 👋 Unfortunately, I couldn't find information about a specific toggle that will definitively prevent an agent from accessing information outside its knowledge base. However, I can share several approaches that might help restrict your agent to only using information from its KB. Here are some methods that might help: ### 1. Prompt Engineering One of the most effective approaches is to use clear, explicit prompts. For example:
Copy code
You are a smart assistant whose responses should be based solely on the provided knowledge base of profoundly false facts. If the knowledge base does not contain the information asked for, respond with 'I do not know'. Always cite the knowledge base when providing an answer.
[Source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1335953119275782144) ### 2. Model Temperature Setting Setting the model temperature to 0 can prevent the AI from being creative and potentially generating responses based on information outside the KB. [Source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342028540085932102) ### 3. Knowledge Base Configuration Parameters Adjust these parameters to fine-tune how the agent uses the KB: - Increase the
scoreThreshold
to filter out irrelevant chunks - Adjust
topK
to control how many results the agent considers - Ensure proper configuration of
searchType
and other parameters [Source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1335953119275782144) ### 4. Custom Tools Approach Using custom tools to invoke the knowledge base can be a safer and more effective option than direct KB integration. [Source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342355912576471112) ### 5. Local Knowledge Base Server
You can set up a local server that handles knowledge base requests and returns only the information you want the agent to access. This gives you complete control over what information is available. [Source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341914745661554788) ### 6. Security Measures For organizations with strict data security needs, isolated Virtual Private Clouds (VPCs) and on-premise deployment options are available. [Source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1344656349367107667) Is there a particular approach from these that you'd like to explore further, or do you have any other questions about implementing these methods? Sources: - [Discord conversation about prompt engineering](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1335953119275782144) - [Discord conversation about model temperature](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342028540085932102) - [Discord conversation about custom tools](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1342355912576471112) - [Discord conversation about local knowledge base server](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341914745661554788) - [Discord conversation about security measures](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1344656349367107667)
s
Hey! To help track down this issue, could you share: - The call ID - When exactly this happened (the timestamp) - What response you expected to get - What response you actually got instead This would really help us figure out what went wrong!