dchoagency
dchoagency3mo ago

Capitalization and API post call

Hi, I’m running into a couple of issues trying to generate a post call to Relevance AI and subsequently produce a quote based on my prompt. 1. Capitalization, when I test a post call using a capitalized entry of “Apartment” the call is successful. However, if I test the call with lower case “apartment” the call is unsuccessful stating the only allowing entries are Apartment/House (screen attached). It’s my understanding that capitalization should not matter. As a workaround even when I added apartment as a possible option, the post call still failed. It also fails when I enter Penthouse even though it too is defined. Any suggestions to triage here? 2. My agent should produce a proposed quote once the user enters a property_type and property_size into the chat box. However, no test produces a quote and simply ends the chat. I see a warning in the logs that the API is failing, even with the capitalized entry of Apartment (see attached) however, when I run the API test on its own I get a completed response without issue. Any help explaining this API error and why the quote won’t produce?
No description
No description
No description
No description
No description
8 Replies
majinnboo
majinnboo3mo ago
Any reason why you are not using the metadata testing/filtering JSON structure via the API reference tab in the voiceflow docs? That would let you know the code is functional in the easiest way as the docs system writes the API Body Raw JSON code for you.
dchoagency
dchoagencyOP3mo ago
Hi there, as far as I can see I'm using the VF docs JSON structure including the capture response. Is there someting here that stands out that is inconsistent with the docs? Here I have property_size without quotes because it is a number not a string. Whether I add them or not I still get an error regardless.
majinnboo
majinnboo3mo ago
Icic. The address from the post is not https://general-runtime.voiceflow.com/knowledge-base/query so it is getting the data from another source. You can use metadata and filtering to get highly specific info all self contained within the API doc. The current address in your first picture suggests it might be harder to get a quick fix.
dchoagency
dchoagencyOP3mo ago
Hi, I cannot change this address for Relevance AI. I'm capturing the post as raw_quote_data which subsequantly feeds into my variable prompt to produce a quote response based on the capture.
W. Williams (SFT)
Ok, the fix is pretty simple. Ensure the property_type value is correct. Just use Regex to make the first letter a capital and the rest lowercase.
dchoagency
dchoagencyOP3mo ago
Thank you, I've solved both issues by testing hardcoded data (Apartment and 1200), confirming my JSON structure was acceptable by the call. This structure isn't consistent with what is currently stated on Relevance AI API v2 documentation but it worked. I then noticed I needed to add prompt directly as opposed to adding a set variable prompt to generate the quote.
W. Williams (SFT)
theVar = theVar.charAt(0).toUpperCase() + theVar.slice(1).toLowerCase();
theVar = theVar.charAt(0).toUpperCase() + theVar.slice(1).toLowerCase();
dchoagency
dchoagencyOP3mo ago
Thanks for this as well!

Did you find this page helpful?