Git Product home page Git Product logo

skaplanofficial / raycast-promptlab Goto Github PK

View Code? Open in Web Editor NEW
233.0 7.0 8.0 157.49 MB

A Raycast extension for creating powerful, contextually-aware AI commands using placeholders, action scripts, selected files, and more.

Home Page: https://www.raycast.com/HelloImSteven/promptlab

TypeScript 93.08% AppleScript 6.92%
ai automation extension mac macos prompts raycast raycast-extension chatgpt-api prompt-engineering

raycast-promptlab's Issues

Get no response with OpenAI

I tried to run Commands with this extension

My configuration is as follows:

{ "model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "{prompt}"}]}

The problem is, that the request is sent, I am billed from OpenAI, but the extension says it got no responses.

OpenAI endpoint issues with prompts

Hello! I am using the OpenAI endpoint.
When I run TechCrunch News or Summarize GitHub trending, I get responses like

As an AI language model, I do not have the ability to analyze today’s trending GitHub repositories as they change frequently, but I can provide a summary of the current trending repositories based on the given link.

It seems the the content from the URL is not being parsed into the prompt.

Models are not saved in the commands

Here are the steps to reproduce:

  1. Open "My PromptLab Commands"
  2. With any command, open "Edit command" menu
  3. Scroll down and change the modal from the current selected to any other
  4. Save the command

Expected result: the command is correctly saved with the new model used, each command run shows different results because it uses different model.
Actual result: the command is not saved, if you go back to the "edit command" menu the model is just as it was before, the results of the command run are similar to the previous.

“Bad Request” on OpenAI

Steps to reproduce:

  • Install latest version from store (1.2.1).
  • Configure with OpenAI example here and a valid OpenAPI key.
  • Select PromptLab > New Chat
  • Enter any text.
  • Run the command.

Results

"Bad Request"

JSON parsing errors

When I run the summarise github trending command, it pulls out the first entry but outputs this to the terminal. I am using OpenAI endpoint.

11:28:03.889 Failed to get JSON from model output
11:28:03.889 Warning: Cannot update a component (`CommandResponse`) while rendering a different component (`CommandResponse`). To locate the bad setState() call inside `CommandResponse`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render
    at CommandResponse (/Users/hsai002/.config/raycast/extensions/promptlab/search-commands.js:16447:11)
    at Nr (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:6:2490)
    at ray-navigation-stack
    at _o (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:6:2088)
    at Suspense
    at wr (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:5:2543)
    at ray-root
    at ti (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/api/index.js:6:3000)```

Azure OpenAI

Any plans to support Azure OpenAI endpoints? I've tried it with what seems to be the correct settings, but no luck yet.

I'm having difficulty debugging what's actually happening. All I've been able to see is the chat gets named Unauthorized.

Azure OpenAI shouldn't be much different from regular OpenAI from what I can tell.

Feature Request: Add all models available via Raycast AI.Model API

Currently the Raycast API makes the following models available via the Model option:

type Model =
  | "anthropic-claude-haiku"
  | "anthropic-claude-opus"
  | "anthropic-claude-sonnet"
  | "openai-gpt-3.5-turbo-instruct"
  | "openai-gpt-3.5-turbo"
  | "openai-gpt-4"
  | "openai-gpt-4-turbo"
  | "perplexity-sonar-medium-online"
  | "perplexity-sonar-small-online"
  | "llama2-70b"
  | "codellama-70b-instruct"
  | "mixtral-8x7b";

This functionality was introduced in v1.71.0.

Model is not supported - Failed to fetch data

Error:

Error: Model is not supported
    at Rr (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/server/index.js:25:230)
    at Ye (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/server/index.js:24:6249)
    at ht (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/server/index.js:24:6374)
    at Immediate.<anonymous> (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/server/index.js:24:6139)
    at process.processImmediate (node:internal/timers:478:21)

When I launch a command, the error appear at the bottom left.

The error do not prevent the command from working, but it is a little annoying.
I am using a local model hosted with Ollama. I have tried to configure the model using both extension settings and the model manager.
At this moment, I am not sure what the extension is trying to do, but my command works fine.

Using Mistral through Jan.ai with this extension

I recently came across this library called Jan.ai, which allows you to run offline models such as Mistral Instruct, which is really powerful. Apparently, this tool has the same API as OpenAI.

Is it possible to use it with this extension for Raycast? If so, is there any resources I could read about this? And if you need my help, please do tell.

This is an example of how I can access the model using their API which is the same as OpenAI's:

curl http://localhost:1337/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer EMPTY" \
  -d '{
     "model": "mistral-ins-7b-q4",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'

Reply:

{"choices":[{"finish_reason":null,"index":0,"message":{"content":" I understand that you have asked me to say that \"this is a test.\" Here is that statement for you: \"This is a test.\" Is there anything specific you would like me to do with this test, or is it simply for my understanding that we are conducting a test? Let me know if there's anything else I can assist you with.","role":"assistant"}}],"created":1705970517,"id":"tWF3q25T3yaeF96K2bVF","model":"_","object":"chat.completion","system_fingerprint":"_","usage":{"completion_tokens":72,"prompt_tokens":14,"total_tokens":86}}% 

Incompatibility with Anthropics’ New Messages API

Hey! So, I'm having some issues when trying to use the Claude3 models with PromptLab, it's not playing nice with the latest version of Anthropics' 'messages' API. The problem is that the new API needs an extra header, "anthropic-version", in the request. Since the extension settings doesn't include a space to specify additional headers, I can't make successful API calls.

Here's an example of what the request should look like:

curl https://api.anthropic.com/v1/messages
--header "x-api-key: $ANTHROPIC_API_KEY"
--header "anthropic-version: 2023-06-01"
--header "content-type: application/json"
--data
'{
"model": "claude-3-opus-20240229",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, world"}
]
}'

Could you please help update the extension to include this new header? Thanks a bunch in advance!

Error when opening "My PromptLab Commands"

Hi,

I installed your extension earlier today and it's fantastic. It was working fine but now when I go to 'My PromptLab Commands' I get the following error:


TypeError: command.acceptedFileExtensions?.split is
not a function
SearchCommand:search-commands.tsx:27:2

24: import path from "path";
25: 
26: export default function SearchCommand(props: { arguments: { commandName: string; queryInput: string } }) {
27:   const { commandName, queryInput } = props.arguments;
     ^
28:   const [commands, setCommands] = useState<Command[]>();
29:   const [targetCategory, setTargetCategory] = useState<string>("All");
30:   const [searchText, setSearchText] = useState<string | undefined>(

SearchCommand:search-commands.tsx:27:2
Nr:index.js:6:2490
    at ray-navigation-stack
_o:index.js:6:2088

Finder - prompt-sets - 13-05-2023 - 20 11 01@2x

I installed a few batches of commands from the store. Most worked well. One issue I had, almost certainly unrelated, was when summarising PDF with filename Walter Murch - In the Blink of an Eye Revised 2nd Edition (2001, Silman-James Pr).pdf, it didn't like it and gave me the error:

Error: ENOENT: no such file or directory, Istat '/Users/
Alex/Downloads/Walter Murch - In the Blink of an Eye
Revised 2nd Edition (2001'
Obiect.IstatSync:node:fs:1569:3

![Finder - Downloads - 13-05-2023 - 20 14 22@2x](https://github.com/SKaplanOfficial/Raycast-PromptLab/assets/11060179/c47d2ea3-d6ad-411e-8d39-747765fa2813)

Renaming it to test.pdf worked and then everything seemed fine after.

The last command I tried to run was 'summarise spoken audio' which gave me an error that unfortunately I didn't capture.

Thanks,

Alex

Issue retrieving calendar events

Hi, PromptLab is having trouble accessing my calendar events. When I run the prompt 'Today's Agenda' that comes with the extension, I get the following error:

Error: Command failed with exit code 1: osascript -e use framework "EventKit"
      property ca : current application
      
      set eventStore to ca's EKEventStore's alloc()'s init()
      eventStore's reset()
      eventStore's requestAccessToEntityType:((get ca's EKEntityMaskEvent) + (get ca's EKEntityMaskReminder)) completion:(missing value)
      delay 0.1
      
      set startDate to ca's NSDate's |date|()
      
      set calendar to ca's NSCalendar's currentCalendar()
      set dateComponents to ca's NSDateComponents's alloc()'s init()
      dateComponents's setDay:1
      set endDate to calendar's dateByAddingComponents:dateComponents toDate:startDate options:(ca's NSCalendarMatchStrictly)
      
      set remindersPredicate to eventStore's predicateForIncompleteRemindersWithDueDateStarting:startDate ending:endDate calendars:(missing value)
      set upcomingReminders to eventStore's remindersMatchingPredicate:remindersPredicate
      set theRemindersData to {title, dueDate} of upcomingReminders
      
      set theReminders to {}
      repeat with index from 1 to (count of upcomingReminders)
        set eventTitle to (item index of item 1 of theRemindersData) as text
        set eventDueDate to item index of item 2 of theRemindersData
        
        set dueDateFormatter to ca's NSDateFormatter's alloc()'s init()
        (dueDateFormatter's setDateFormat:"MMMM dd, YYYY 'at' HH:mm a")
        set eventDueString to (dueDateFormatter's stringFromDate:eventDueDate)
        
        set reminderInfo to eventTitle & " on " & eventDueString
        copy reminderInfo to end of theReminders
      end repeat
      
      return theReminders 
932:948: execution error: Can’t get title of missing value. (-1728)

      property ca : current application
      
      set eventStore to ca's EKEventStore's alloc()'s init()
      eventStore's reset()

I tried creating my own prompt using {{weekEvents}} but it returns nothing, even though there are plenty of events on my calendar.

Any help would be appreciated! Thank you.

Change language

Hey, I just tried this extension and it is so good! Thank you very much! Is there any way that I can configure the AI (I'm using OpenAI API with my own key), to respond in German? Currently, even when I feed the AI with German content, it responds in English.

Plugin broken with Raycast 1.51.0 (Pro)

I've been enjoying Raycast-PromptLab since discovering it this morning, until this afternoon's Raycast update (1.51.0) which officially released Raycast AI... 😅

No matter which prompt I use, I get the same message, even after subscribing to the Raycast Pro membership.

Thank you for your work on Raycast-PromptLab!

Screenshot 2023-05-10 at 13 41 50

Switch browser or mail app

Hi, how can I edit the Summarize Current Tab or Summarize Last Email commands so that they use different default apps (Edge instead of Safari, Outlook instead of Mail)?

Running PromptLab Commands via PopClip

Discussed in #29

Originally posted by SKaplanOfficial January 14, 2024
To use PromptLab commands with PopClip, you can wrap the deeplink for a command in a PopClip extension snippet. All placeholders or action scripts used in the command will still work as intended. For example, to replace the selected text with the response from AI, you can use this extension that runs the "Ask AI & Replace Selection" command (assuming you've installed the command from the store):

#popclip extension snippet to replace the selected text with output from Raycast AI
name: Replace With AI Response
icon: AI
applescript: do shell script "open -g raycast://extensions/HelloImSteven/promptlab/search-commands?arguments=%7B%22commandName%22:%22Ask%20AI%20%26%20Replace%20Selection%22%7D"

We use Applecript and open -g to ensure the selected text comes from the target app rather than Raycast itself.

Inclusion of placeholders causes prompts to load indefinitely

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.