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

Text-Generator.io Support #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# natbot

Drive a browser with GPT-3
Drive a browser with GPT-3 or [Text-Generator.io](https://text-generator.io)

Here's a demo: https://twitter.com/natfriedman/status/1575631194032549888

Expand All @@ -12,3 +12,19 @@ Lots of ideas for improvement:
- Let the agent use multiple tabs and switch between them

Improvements welcome!


### Running

#### Setup

```
pip install -r requirements.txt
playwright install
```

#### Run

```
python natbot.py
```
6 changes: 5 additions & 1 deletion natbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,11 @@ def add_to_hash_tree(hash_tree, tag, node_id, node_name, parent_id):
):
_crawler = Crawler()
openai.api_key = os.environ.get("OPENAI_API_KEY")

# use text-generator.io instead of OpenAI if there is a environment var set
text_generator_api_key = os.getenv("TEXTGENERATOR_API_KEY")
if text_generator_api_key:
openai.api_key = text_generator_api_key
openai.api_base = "https://api.text-generator.io"
def print_help():
print(
"(g) to visit url\n(u) scroll up\n(d) scroll dow\n(c) to click\n(t) to type\n" +
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

openai
playwright