Put the value obtained by AI into formparagraph as initial value and modify it later

I want to put the value obtained by AI into formparagraph as initial value and modify it later.The following code does not allow me to change the initial value of the formparagraph

{full_name={site: text; selector=.css-94i3cz; page=https://karte.medley.life/; select=ifneeded}}{openai-text: As an internist, you should instruct your patients on lifestyle-related diseases. If you do not see the word “smoking” in the medical record, you do not smoke, so do not include smoking cessation in your teaching. Constraints: Keep it brief. No more than two bullet points, each of which should be no more than 80 words. No more than two bullet points.。: {site: text; page=https://karte.medley.life/; select=ifneeded; selector=textarea}; name=tex; format=none}{formparagraph: name=tex; cols=100; rows=3; default={=tex1}}

It I set the value output by AI in Default, but in that case I get the following error
[Error - “default” cannot depend on form data here]

{full_name={site: text; selector=.css-94i3cz; page=https://karte.medley.life/; select=ifneeded}}{openai-text: As an internist, you should instruct your patients on lifestyle-related diseases. If you do not see the word “smoking” in the medical record, you do not smoke, so do not include smoking cessation in your teaching. Constraints: Keep it brief. No more than two bullet points, each of which should be no more than 80 words. No more than two bullet points.。: {site: text; page=https://karte.medley.life/; select=ifneeded; selector=textarea}; name=tex; format=none}{formparagraph: name=text; cols=100; rows=3; default={=tex}}

Hi @N_Saito ,
You can try using without default and it should work. Please let me know if that does not or you have a different type of snippet.

{openai-text: As an internist, you should instruct your patients on lifestyle-related diseases. If you do not see the word “smoking” in the medical record, you do not smoke, so do not include smoking cessation in your teaching. Constraints: Keep it brief. No more than two bullet points, each of which should be no more than 80 words. No more than two bullet points.。: {site: text; page=https://karte.medley.life/; select=ifneeded; selector=textarea}; name=tex; format=none}{formparagraph: name=tex; cols=100; rows=3}

Note: We would recommend using our new AI product AI Blaze . You can check more information at AI Blaze: AI Writing and Editing . This makes it easier to use an AI response also help with some formatting from AI.

@VinodGubbala Thank you, in this way, the formparagraph is blank.What I want to do is to use AI to judge the document and put it in the formparagraph in a form that can be modified later.

I am also using AI blaze, but it is inconvenient that I cannot use AI for a part of the document (AI blaze creates the whole document).

Appolgies. I made a mistake have the form names different. Form name of ai command and formparagraph should be same.
I have modified the snippet again to represent the correct information.

Can you please elaborate this a little. You can use the {site} command like you had in the open ai command or can also select the part of the contents in the webpage to give the context.

@VinodGubbala Thanks.
I have the information in my electronic medical record.
{site: text; page=https://karte.medley.life/; select=ifneeded; selector=textarea}; name=tex; format=none}
and have the AI come up with appropriate lifestyle guidance content. I want to be able to change the contents of the formparagraph later because they are inappropriate or do not adhere to the character limit.

Sure. Do you have all the information you needed?

@VinodGubbala If I use the same name for the AI command and the formparagraph, I can't modify it later, that's the problem.

Are you using the same snippet like me?
The exact snippet I shared, I could modify the contents before inserting.

If the exact snippet is working, but not your original snippet. Please share a snippet I could test (make sure to redact sensitive information)

If the exact snippet does not work, please email us at support@blaze.today so we can debug.

@VinodGubbala Sorry, it works fine. I see that the code in the original post had been modified...I didn't check enough.

I have been trying various things and found that the first line prevents the formparagraph from changing, even though this first line of code only reads the patient name from the medical record.

{full_name={site: text; selector=.css-94i3cz; page=https://karte.medley.life/; select=ifneeded}}
{openai-text: As an internist, you should instruct your patients on lifestyle-related diseases. If you do not see the word “smoking” in the medical record, you do not smoke, so do not include smoking cessation in your teaching. Constraints: Keep it brief. No more than two bullet points, each of which should be no more than 80 words. No more than two bullet points.。: {site: text; page=https://karte.medley.life/
; select=ifneeded; selector=.css-8u2jis}; name=tex; format=none}{formparagraph: name=tex; cols=100; rows=3; default=}

Thanks for sharing this.
I would recommend you to use the urlload directly.

Something like

{full_name={site: text; selector=.css-94i3cz; page=https://karte.medley.life/; select=ifneeded}}
{urlload: https://api.openai.com/v1/completions; method=POST; body={"model": "gpt-3.5-turbo-instruct", "prompt": "As an internist, you should instruct your patients on lifestyle-related diseases. If you do not see the word “smoking” in the medical record, you do not smoke, so do not include smoking cessation in your teaching. Constraints: Keep it brief. No more than two bullet points, each of which should be no more than 80 words. No more than two bullet points.。: {site: text; page=https://karte.medley.life/; select=ifneeded; selector=.css-8u2jis}"}; done=(res) -> ["tex": fromJSON(res).choices[1].text]; headers=content-type:application/json, Authorization:\ Bearer API_KEY}
{formparagraph: name=tex; cols=100; rows=3; default=}

Please make sure to change the API_KEY to your own key

You should see this at the bottom of the snippet

Please click on allow.

Alternatively, you can go to folder, on the right hand side you should see Connected snippet folder settings. Click on the Configure below it.
Allow the domain api.openai.com and click on save.

@VinodGubbala Thank you, I got another error:
"choices" is not in the list

I didn't handle errors. You might want to use catch and handle it.
In this case, you need to change the API key in the urlload.

@VinodGubbala Thank you for your help.

@VinodGubbala

Just to piggy-back on this thread, I have encountered the same "choices" is not in the list error, even after inputting my API key in the urlload.

  • The API key is tied to another gmail account relative to my textblaze account, this does not have any impact, correct?

Example:

{`Txt-Test`="Fracture: Radius"}
{urlload: https://api.openai.com/v1/completions; method=POST; body={"model": "gpt-3.5-turbo-instruct", "prompt": "Look at {=`txt-test`} and tell me which bone is fractured in one word"}; done=(res) -> ["Bone": fromJSON(res).choices[1].text]; headers=content-type:application/json, Authorization:CODE HIDDEN}

{formparagraph: name=Bone}

Thank you in advance for the help

Hey @AAldea
I believe you have the code incorrect. The code in the authorizaation header should start with Bearer.

Authorization:CODE HIDDEN should be Authorization: Bearer CODE HIDDEN