Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inclusion of placeholders causes prompts to load indefinitely #31

Open
react-muzi opened this issue Jan 21, 2024 · 12 comments
Open

Inclusion of placeholders causes prompts to load indefinitely #31

react-muzi opened this issue Jan 21, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@react-muzi
Copy link

Hi, PromptLab has been working fairly well for me when used without placeholders (anything with {{}}) However as soon as I include terms like {{selectedText}} the prompts will show "loading response" indefinitely. I'm using my personal (not Raycast( openAI endpoint - is there any way to diagnose what exactly the issue is?

@react-muzi
Copy link
Author

Snipaste_2024-01-21_22-03-57 Snipaste_2024-01-21_22-04-07

@SKaplanOfficial
Copy link
Owner

Hi, is the model you're using one that I can set up and test myself (e.g. ollama)? Also, can you give an example of some selected text on which it fails?

@react-muzi
Copy link
Author

Hi, is the model you're using one that I can set up and test myself (e.g. ollama)? Also, can you give an example of some selected text on which it fails?

Thanks for looking into this. Here are the details:

  1. I'm using GPT-4 with the exact same parameters as specified in the github example
image
  1. I've included some example texts below (I selected these text in my outlook app on MacOS Sonoma). However I should note that this is a universal bug with all placeholders. So none of the other commands with placeholders have been able to work for me - including {{clipboardText}} or {{currentTabText}} - which presumably renders the specific text selected irrelevant
Dear [XXX],

Thank you for taking the time to apply for an opportunity with our company. We are excited to consider you for an opportunity to advance the way the world pays, banks and invests.

We are currently reviewing your application and greatly appreciate your interest in FIS.

@SKaplanOfficial
Copy link
Owner

Hm, I think you need to use Bearer Token for the auth type instead of API key. Not sure why it'd work without placeholders involved, though. If you change the auth type, does it work?

@react-muzi
Copy link
Author

react-muzi commented Jan 21, 2024

Hm, I think you need to use Bearer Token for the auth type instead of API key. Not sure why it'd work without placeholders involved, though. If you change the auth type, does it work?

Sadly not. I'm sure I was using bearer tokens for some of the previous iterations (tried to delete and re-add the models a couple of times to see if the issue persisted) so auth types is probably not the blocker here. Apologies for the confusion
image

@SKaplanOfficial
Copy link
Owner

Hmm, everything is working for me so I'm still not sure what's going wrong. Apologies for all the back-and-forth, but can you edit the command and make sure it's using the expected model? If it's not that, I will spend some time digging into it tomorrow.

@SKaplanOfficial SKaplanOfficial added the bug Something isn't working label Jan 21, 2024
@react-muzi
Copy link
Author

Hmm, everything is working for me so I'm still not sure what's going wrong. Apologies for all the back-and-forth, but can you edit the command and make sure it's using the expected model? If it's not that, I will spend some time digging into it tomorrow.

No problem at all - I can confirm that I'm using the expected model with my openai API (and I just tried every other model as well to no avail). It really does seem like the {{}} might be what's causing the problem, although I also struggle to see how.

Take all the time you need - this is a great product and I'm really looking forward to exploring everything I could do with placeholders. Thanks again!

@SKaplanOfficial
Copy link
Owner

Still no luck reproducing this. When you get a chance, can you try importing the following command (using "Import PromptLab Commands"), running it, and using the action menu to copy the full prompt sent to the model? I'm wondering if the placeholders are getting replaced or if it's getting hung up before that.

{"Test Placeholders":{"id":"5841d970-ec94-43d3-852e-b5551fba1586","name":"Test Placeholders","prompt":"Repeat this exactly:\\\n###\\\n{{date}}\\\n{{time}}\\\n###","icon":"command-symbol-16","iconColor":"raycast-red","minNumFiles":"0","acceptedFileExtensions":"","useMetadata":false,"useAudioDetails":false,"useSoundClassification":false,"useSubjectClassification":false,"useRectangleDetection":false,"useBarcodeDetection":false,"useFaceDetection":false,"useHorizonDetection":false,"outputKind":"detail","actionScript":"","showResponse":true,"description":"","useSaliencyAnalysis":false,"author":"","website":"","version":"1.0.0","requirements":"","scriptKind":"applescript","categories":["Other"],"installedFromStore":false,"setupLocked":false,"useSpeech":false,"speakResponse":false,"showInMenuBar":false,"favorited":false,"timesExecuted":0,"recordRuns":false,"runs":[]}}

@react-muzi
Copy link
Author

react-muzi commented Jan 22, 2024

Still no luck reproducing this. When you get a chance, can you try importing the following command (using "Import PromptLab Commands"), running it, and using the action menu to copy the full prompt sent to the model? I'm wondering if the placeholders are getting replaced or if it's getting hung up before that.

{"Test Placeholders":{"id":"5841d970-ec94-43d3-852e-b5551fba1586","name":"Test Placeholders","prompt":"Repeat this exactly:\\\n###\\\n{{date}}\\\n{{time}}\\\n###","icon":"command-symbol-16","iconColor":"raycast-red","minNumFiles":"0","acceptedFileExtensions":"","useMetadata":false,"useAudioDetails":false,"useSoundClassification":false,"useSubjectClassification":false,"useRectangleDetection":false,"useBarcodeDetection":false,"useFaceDetection":false,"useHorizonDetection":false,"outputKind":"detail","actionScript":"","showResponse":true,"description":"","useSaliencyAnalysis":false,"author":"","website":"","version":"1.0.0","requirements":"","scriptKind":"applescript","categories":["Other"],"installedFromStore":false,"setupLocked":false,"useSpeech":false,"speakResponse":false,"showInMenuBar":false,"favorited":false,"timesExecuted":0,"recordRuns":false,"runs":[]}}

Thanks, this one actually returned an error (but I can confirm that the previous ones still load indefinitely. Below is the error code for reference. Also if I manually remove the \ in the prompt, the promot sent to the model includes the actual date and time, but still loads indefinitely.

Original version

image image
SyntaxError: Bad escaped character in JSON at position 83

ag:CommandResponse.tsx:28:10

---
25:   setCommands?: (commands: Command[]) => void;
26:   onCompletion?: (newRun: PLCommandRunProperties) => void;
27: }) {
28:   const { command, prompt, input, setCommands, onCompletion } = props;
29:   const [substitutedPrompt, setSubstitutedPrompt] = useState<string>(prompt);
30:   const [loadingData, setLoadingData] = useState<boolean>(true);
31:   const [shouldCancel, setShouldCancel] = useState<boolean>(false);
---

Dr:index.js:11:2490
at ray-navigation-stack
Lo:index.js:11:2088

Manually adjusted version

image image

Repeat this exactly:

January 22, 2024
22:45:18 PM

@SKaplanOfficial
Copy link
Owner

That error makes sense (it's a bug I've fixed in the upcoming version). Unfortunately, I'm at a loss for why it gets stuck loading in this case. If you replace the prompt in that command with the fully substituted text, i.e.:

Repeat this exactly:

January 22, 2024
22:45:18 PM

Does it work then?

Also, just to make sure we're covering all bases, can you copy the model JSON using the action menu and share that?

@react-muzi
Copy link
Author

That error makes sense (it's a bug I've fixed in the upcoming version). Unfortunately, I'm at a loss for why it gets stuck loading in this case. If you replace the prompt in that command with the fully substituted text, i.e.:

Repeat this exactly:

January 22, 2024
22:45:18 PM

Does it work then?

Also, just to make sure we're covering all bases, can you copy the model JSON using the action menu and share that?

Replacing it with actual text somehow makes it work (wish I could explain why lol)
image

Here's the model JSON for reference
{"--model-GPT-4":{"authType":"bearerToken","notes":"","inputSchema":"{ "model": "gpt-4", "messages": [{"role": "user", "content": "{prompt}"}], "stream": true }","endpoint":"https://api.openai.com/v1/chat/completions","description":"","icon":"cog-16","name":"GPT-4","isDefault":true,"apiKey":"","outputTiming":"async","favorited":true,"id":"","iconColor":"raycast-red","lengthLimit":"2500","temperature":"1.0","outputKeyPath":"choices[0].delta.content"}}

@zeroaddresss
Copy link

Experiencing the same issue as of today, April 30th 2024. Any fixes planned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants