Skip to content

Commit 30fc217

Browse files
authored
woops (#1163)
* Add thread summary asset * add basic asset impl to slackbot * several things * slight fix * annoying
1 parent 157f07c commit 30fc217

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

examples/slackbot/src/slackbot/__main__.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@
1111
logger = get_logger(__name__)
1212
logger.debug(f"Starting Slackbot with model: {settings.model_name}")
1313

14-
if "gpt" in settings.model_name:
15-
if not (openai_api_key := os.getenv("OPENAI_API_KEY")):
16-
os.environ["OPENAI_API_KEY"] = Secret.load(
17-
settings.openai_api_key_secret_name, _sync=True
18-
).get()
19-
if "claude" in settings.model_name:
20-
if not (anthropic_api_key := os.getenv("ANTHROPIC_API_KEY")):
21-
os.environ["ANTHROPIC_API_KEY"] = Secret.load(
22-
settings.anthropic_key_secret_name, _sync=True
23-
).get()
14+
if not (openai_api_key := os.getenv("OPENAI_API_KEY")): # Needed for embeddings
15+
os.environ["OPENAI_API_KEY"] = Secret.load(
16+
settings.openai_api_key_secret_name, _sync=True
17+
).get()
18+
19+
if not (anthropic_api_key := os.getenv("ANTHROPIC_API_KEY")): # Needed for LLM
20+
os.environ["ANTHROPIC_API_KEY"] = Secret.load(
21+
settings.anthropic_key_secret_name, _sync=True
22+
).get()
2423

2524
uvicorn.run(
2625
"slackbot.api:app",

examples/slackbot/src/slackbot/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def personality_and_maybe_notes(ctx: RunContext[UserContext]) -> str:
199199
async def store_facts_about_user(
200200
ctx: RunContext[UserContext], facts: list[str]
201201
) -> str:
202-
"""Store facts about the user, tracking data lineage from Slack messages."""
202+
"""Store facts about the user that are useful for answering their questions."""
203203
print(f"Storing {len(facts)} facts about user {ctx.deps['user_id']}")
204204
# This creates an asset dependency: USER_FACTS depends on SLACK_MESSAGES
205205
message = await store_user_facts(ctx, facts)
@@ -208,6 +208,7 @@ async def store_facts_about_user(
208208

209209
@agent.tool
210210
def delete_facts_about_user(ctx: RunContext[UserContext], related_to: str) -> str:
211+
"""Delete facts about the user related to a specific topic."""
211212
print(f"forgetting stuff about {ctx.deps['user_id']} related to {related_to}")
212213
user_id = ctx.deps["user_id"]
213214
with TurboPuffer(

0 commit comments

Comments
 (0)