From 7f8ad84ff651dc0683b30c61a04b7eec42c3efd2 Mon Sep 17 00:00:00 2001 From: NaN <169948333+NaN-KL@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:21:48 -0700 Subject: [PATCH 1/3] Update README.md - Most importantly removed the sudo directive from the Mac OS Chrome cmd. Testing determined it is only required for Brave (WTF Brave?!) - Added example from Chromium - Added `--guest` directive to all MacOS examples. - Applied other formatting, grammar, and punctuation fixes. --- README.md | 130 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 68 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 8cb1504..108a448 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# sentient - browser controlling agents in 3 lines of code +# Sentient - Browser Controlling Agents in 3 Lines of Code -[beta] +[Beta] ```python from sentient import sentient @@ -8,102 +8,108 @@ import asyncio result = asyncio.run(sentient.invoke(goal="play shape of you on youtube")) ``` -### setup +## Setup -1. install sentient `pip install sentient` +1. Install sentient: + ``` + pip install sentient + ``` -2. currently, you need to start chrome in dev mode - in a seaparate terminal on the port 9222. use the below commands to start the chrome instance and do necesssary logins if needed +2. Start Chrome in dev mode on port 9222 in a separate terminal. Use the appropriate command for your operating system: -for mac, use command - + MacOS (Chrome): + ```bash + /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --guest + ``` -```bash -sudo /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 -``` - -to run brave browser (mac) - + MacOS (Chromium): + ```bash + /Applications/Chromium.app/Contents/MacOS/Chromium --remote-debugging-port=9222 --guest + ``` -```bash -sudo /Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser --remote-debugging-port=9222 --guest -``` + MacOS (Brave): + ```bash + sudo /Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser --remote-debugging-port=9222 --guest + ``` -for linux - + Linux: + ```bash + google-chrome --remote-debugging-port=9222 + ``` -```bash -google-chrome --remote-debugging-port=9222 -``` + Windows: + ```bash + "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 + ``` -for windows - +3. Set up OpenAI API key: + Create a `.env` file or use: + ``` + export OPENAI_API_KEY="sk-proj-" + ``` -```bash -"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 -``` +4. Run the agent: + ```python + from sentient import sentient + import asyncio -4. setup open ai api key in a .env file or `export OPENAI_API_KEY="sk-proj-"` + # If you want to run in a Jupyter notebook, uncomment the following two lines: + # import nest_asyncio + # nest_asyncio.apply() -5. run the agent + result = asyncio.run(sentient.invoke("play shape of you on youtube")) + ``` -```python -from sentient import sentient -import asyncio - -# if you wanna run in a jupyter notebook, uncomment the following two lines : -#import nest_asyncio -#nest_asyncio.apply() - -result = asyncio.run(sentient.invoke("play shape of you on youtube")) -``` + Note: If running in a Jupyter notebook, you need to uncomment and use the `nest_asyncio` lines as shown above. -6. note - by default we use `gpt-4o-2024-08-06` from `openai` to run sentient as it is the best performing model. you can also use other models like `gpt4o` or `gpt4o-mini` but the reliabilty may take some hit. +5. Note: By default, we use `gpt-4-0824` from `openai` to run sentient as it is the best performing model. You can also use other models like `gpt4` or `gpt4-32k`, but reliability may be affected. ---- +## Setting Custom Task-Specific Instructions -### setting custom task specific instructions +You can customize the agent's behavior by providing natural language instructions: -you can customise the agent's behaviour by providing natural language descripition of how it should naviagate or what all things it should keep in mind while executing a particualr task. -this is helpful in improving the accuracy and reliability of the agent on your specific task. - -``` +```python from sentient import sentient import asyncio custom_instructions = """ -1. Directly go to youtube.com rather than searching for the song on google! +1. Directly go to youtube.com rather than searching for the song on Google! """ -#use with open ai +# Use with OpenAI result = asyncio.run(sentient.invoke( goal="play shape of you on youtube", task_instructions=custom_instructions, provider="openai", - model="gpt-4o-2024-08-06")) + model="gpt-4-0824")) ``` ---- +## Using Providers Other Than OpenAI -### using providers other than open ai +We currently support Together AI and Ollama as providers. If you wish to have others included, please create a new issue. -we currently support togehter ai and ollama as providers. if you wish to have others included, please create a new issue. you can pass custom instructions in a similar fashion as shown above. you can also refer the [cookbook](cookbook.py) for seeing all examples of using sentient with various providers. +For more examples of using Sentient with various providers, refer to the [cookbook](cookbook.py). -#### using together ai hosted models +### Using Together AI Hosted Models -1. set API key for Together AI - `export TOGETHER_API_KEY="your-api-key"` +1. Set API key for Together AI: + ``` + export TOGETHER_API_KEY="your-api-key" + ``` -2. pass provider and model options to the invoke command. - -``` -#use with together ai -result = asyncio.run(sentient.invoke( - goal="play shape of you on youtube", - provider="together", - model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo")) -``` +2. Pass provider and model options to the invoke command: + ```python + result = asyncio.run(sentient.invoke( + goal="play shape of you on youtube", + provider="together", + model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo")) + ``` -#### using ollama +### Using Ollama -1. ensure the ollama server is on. you just need to pass the name of the model. +Ensure the Ollama server is on. You just need to pass the name of the model: -``` -#use with ollama +```python result = asyncio.run(sentient.invoke( goal="play shape of you on youtube", provider="ollama", From 79be6eb3619aaffba98bf221584be6433e7b8043 Mon Sep 17 00:00:00 2001 From: NaN <169948333+NaN-KL@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:30:15 -0700 Subject: [PATCH 2/3] Update README.md lowercased the name to keep inline --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 108a448..7b62dc2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Sentient - Browser Controlling Agents in 3 Lines of Code +# sentient - Browser Controlling Agents in 3 Lines of Code [Beta] From 8a91baa090f585fbc093a47f85c154262c3d3934 Mon Sep 17 00:00:00 2001 From: NaN <169948333+NaN-KL@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:49:02 -0700 Subject: [PATCH 3/3] Update README.md fixed model name refs --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7b62dc2..ddf8d2a 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ result = asyncio.run(sentient.invoke(goal="play shape of you on youtube")) Note: If running in a Jupyter notebook, you need to uncomment and use the `nest_asyncio` lines as shown above. -5. Note: By default, we use `gpt-4-0824` from `openai` to run sentient as it is the best performing model. You can also use other models like `gpt4` or `gpt4-32k`, but reliability may be affected. +5. Note: By default, we use `gpt-4o-2024-08-06` from `openai` to run sentient as it is the best performing model. You can also use other models like `gpt4o` or `gpt4o-mini`, but reliability may be affected. ## Setting Custom Task-Specific Instructions @@ -81,7 +81,7 @@ result = asyncio.run(sentient.invoke( goal="play shape of you on youtube", task_instructions=custom_instructions, provider="openai", - model="gpt-4-0824")) + model="gpt-4o-2024-08-06")) ``` ## Using Providers Other Than OpenAI