-
Notifications
You must be signed in to change notification settings - Fork 397
revert: remove letta learning-sdk integration #1253
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,8 +17,11 @@ | |||||
| from pydantic_ai.models.anthropic import AnthropicModel | ||||||
| from pydantic_ai.providers import Provider | ||||||
| from pydantic_ai.settings import ModelSettings | ||||||
| from raggy.vectorstores.tpuf import TurboPuffer, query_namespace | ||||||
| from turbopuffer import NotFoundError | ||||||
|
|
||||||
| from slackbot._internal.templates import DEFAULT_SYSTEM_PROMPT | ||||||
| from slackbot.assets import store_user_facts | ||||||
| from slackbot.github import ( | ||||||
| GitHubAuthError, | ||||||
| GitHubError, | ||||||
|
|
@@ -133,13 +136,23 @@ def _insert(): | |||||
| @task(task_run_name="build user context for {user_id}") | ||||||
| def build_user_context( | ||||||
| user_id: str, | ||||||
| user_question: str, | ||||||
| thread_ts: str, | ||||||
| workspace_name: str, | ||||||
| channel_id: str, | ||||||
| bot_id: str, | ||||||
| ) -> UserContext: | ||||||
| try: | ||||||
| user_notes = query_namespace( | ||||||
| query_text=user_question, | ||||||
| namespace=f"{settings.user_facts_namespace_prefix}{user_id}", | ||||||
| top_k=5, | ||||||
| ) | ||||||
| except NotFoundError: | ||||||
| user_notes = "<No notes found>" | ||||||
| return UserContext( | ||||||
| user_id=user_id, | ||||||
| user_notes=user_notes, | ||||||
| thread_ts=thread_ts, | ||||||
| workspace_name=workspace_name, | ||||||
| channel_id=channel_id, | ||||||
|
|
@@ -164,7 +177,6 @@ def create_agent( | |||||
| UserContext, str | ||||||
| ]( | ||||||
| model=ai_model, | ||||||
| system_prompt=DEFAULT_SYSTEM_PROMPT, | ||||||
| model_settings=ModelSettings(temperature=settings.temperature), | ||||||
| tools=[ | ||||||
| research_prefect_topic, # Tool for researching Prefect topics | ||||||
|
|
@@ -177,6 +189,42 @@ def create_agent( | |||||
| deps_type=UserContext, | ||||||
| ) | ||||||
|
|
||||||
| @agent.system_prompt | ||||||
| def personality_and_maybe_notes(ctx: RunContext[UserContext]) -> str: | ||||||
| system_prompt = DEFAULT_SYSTEM_PROMPT + ( | ||||||
| f"\n\nUser notes: {ctx.deps['user_notes']}" | ||||||
| if ctx.deps["user_notes"] | ||||||
| else "" | ||||||
| ) | ||||||
| print(f"System prompt: {system_prompt}") | ||||||
| return system_prompt | ||||||
|
|
||||||
| @agent.tool | ||||||
| async def store_facts_about_user( | ||||||
| ctx: RunContext[UserContext], facts: list[str] | ||||||
| ) -> str: | ||||||
| """Store facts about the user that are useful for answering their questions.""" | ||||||
| print(f"Storing {len(facts)} facts about user {ctx.deps['user_id']}") | ||||||
| # This creates an asset dependency: USER_FACTS depends on SLACK_MESSAGES | ||||||
|
Comment on lines
+207
to
+208
|
||||||
| message = await store_user_facts(ctx, facts) | ||||||
| print(message) | ||||||
| return message | ||||||
|
|
||||||
| @agent.tool | ||||||
| def delete_facts_about_user(ctx: RunContext[UserContext], related_to: str) -> str: | ||||||
| """Delete facts about the user related to a specific topic.""" | ||||||
| print(f"forgetting stuff about {ctx.deps['user_id']} related to {related_to}") | ||||||
|
||||||
| print(f"forgetting stuff about {ctx.deps['user_id']} related to {related_to}") | |
| get_run_logger().info(f"forgetting stuff about {ctx.deps['user_id']} related to {related_to}") |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These debug print statements should be replaced with proper logging using get_run_logger() for consistency with the rest of the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This debug print statement should be removed or replaced with proper logging using the run logger that's already available in the function scope.