Skip to content

Answers different greatly between Bedrock (using Amazon Titan Premier) and via API call for same queries?

0

I have a single PDF that should be the sole data source for my LLM responses. When I query via my console or internal tools, the answer is correct and clearly uses the PDF content. However, making an API call to Amazon Bedrock Titan produces unrelated information (I'm assuming from its general knowledege). What are best practices or prompt strategies to ensure Titan strictly uses my provided PDF, avoiding any “outside” data or hallucinations when queried through API? Thanks!

asked 2 years ago253 views

2 Answers
0

Hello.

Which API are you using specifically?
I think the API you are running may be incorrect.
Since you are using a data source, I assume you are using a knowledge base, but are you using the retrieve_and_generate() API?
https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-test.html

EXPERT

answered 2 years ago

0

Hi Zach, If you are using the model directly and passing the document rather than using a knowledge base, here are a couple things you can try:

  • Check you are using exactly the same inference configuration and format as you were in the console. If you turn on developer tools in your browser you can inspect the network calls when you are using the console to see the exact format of the API call being made from the console.
  • If you are asking follow-on questions about your document make sure you are including all of the previous conversation including the document and any previous assistant responses otherwise it will have lost context (you'll see this in the API calls from the console in your browser too)
  • You can also add instructions to your prompt to explicitly tell the model to only use information from the document you have sent in and not include any additional information.
AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.