-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.py
More file actions
29 lines (23 loc) · 1.25 KB
/
agent.py
File metadata and controls
29 lines (23 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import sys
from subconscious import Subconscious # python package: subconscious-sdk
from prompt import instruction
from moltbook_tools import tools
api_key = os.environ.get("SUBCONSCIOUS_API_KEY")
if not api_key:
print("Error: SUBCONSCIOUS_API_KEY environment variable is not set.")
print("Get your API key from https://subconscious.dev")
sys.exit(1)
client = Subconscious(api_key=api_key)
product_info = " ".join(sys.argv[1:]) if len(sys.argv) > 1 else "Example Product: A new AI-powered writing assistant that helps users generate high-quality content quickly and easily. It offers features such as grammar correction, style suggestions, and content generation based on user prompts. The target audience includes writers, bloggers, and content creators looking to improve their writing efficiency and quality. Competitors include Grammarly, Jasper, and Copy.ai."
def get_input(product_info):
return instruction.replace("[PRODUCT]", product_info)
run = client.run(
engine="tim-gpt-heavy",
input={
"instructions": get_input(product_info),
"tools": [{"type": "platform", "id": "fresh_search"}, {"type": "platform", "id": "news_search"}] + tools,
},
options={"await_completion": True},
)
print(run.result.answer)