radames / LLM-automator

Create keyboard shortcuts for an LLM using OpenAI GPT, Ollama, HuggingFace with Automator on macOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thanks! This is a great. A few things perhaps you need to specify in the README.md file:

dafraile opened this issue · comments

          Thanks! This is a great. A few things perhaps you need to specify in the README.md file:

I had a bit of an issue with my installed python (conda) and had to do a fresh reinstall so Automator finds it in the correct path.

Related to that, the "default" python needs to have the correct packages installed: for the Hugginface's Mixtral implemmentation needs "requests" library. for the OpenAI one, it needs openai library installed.

Last, somehow I get different behaviour from Mixtral and OpenAI. So when I ask OpenAI version to correct a badly spelled text such as:

"I want to write this crayz letter that need to sound like it will get e ajob in acdemia but pleas ecorrect myt grammar and all the stuff"

OpenAI Answer:
I wish to compose an outstanding letter that will secure me a position in academia. Please correct the grammatical errors and enhance my content.

Mixtral:
"Certainly! Here's your corrected letter:

Dear Hiring Committee,

I am writing to express my interest in the open academic position at your esteemed institution. I am confident that my unique experiences, exceptional work ethic, and unwavering passion for my field make me an ideal candidate for this role.

Throughout my academic career, I have consistently demonstrated a commitment to excellence. I have published numerous articles in respected journals, presented at conferences both nationally and internationally, and have received numerous accolades for my research and teaching.

My research interests lie at the intersection of [insert specific areas of interest], and I am eager to continue exploring these topics in a rigorous and collaborative academic environment. I am confident that my expertise and innovative approach will make a valuable contribution to your department.

In addition to my research, I am a dedicated and engaging teacher. I have experience teaching a variety of courses at both the undergraduate and graduate levels, and have received consistently high student evaluations. I believe that effective teaching is built on a foundation of strong relationships, clear communication, and a commitment to student success.

I am excited about the possibility of joining your institution and contributing to your mission of academic excellence. Thank you for considering my application. I look forward to the opportunity to discuss my qualifications further.

Sincerely,
[Your Name]"

So it seems, Mixtral overwrites the prompt and guesses what I want instead. Both things are useful although you may want to fix this in the prompt or allow the user to choose what it wants to do (one automator action for grammar and composing check, and one for automating tasks).

Thanks again mate, awesome job!

Originally posted by @dafraile in #2 (comment)

On further exploration it seems that it also happens with OpenAI, sometimes it overwrites what you said, sometimes it does the task or asks for the task you wanted it to complete (I've noticed this when changing from "gpt-4 to the gpt4-1106 preview model". Perhaps it can be fixed by tuning the prompt.

hi @dafraile, thank you for the feedback. Indeed, I had similar challenges when handling the Python version with Automator. It's a bit inflexible, as it appears to use the OSX system version.

image

I've added a tentative step to install the package in case of

try:
import requests
except ImportError:
import subprocess
subprocess.check_call(["python3", "-m", "pip", "install", "requests"])
import requests
try:
import openai
except ImportError:
import subprocess
subprocess.check_call(["python3", "-m", "pip", "install", "openai"])
import openai

In terms of LLM behavior, you may want to experiment with system and action prompts here to tailor the workflow to what is requested of the LLM.

system = "You are a professional expert, renowned as an exceptionally skilled and efficient English copywriter, a meticulous text editor, and an esteemed New York Times editor."
instruction = "Fix spelling and grammar errors, improve clarity, and make sure your writing is polished and professional, keep the original voice and tone of the writing, only respond with the correct answer, no explanation is needed."
user_message = input_string