[slackbot] improve answers#1159
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR improves Slackbot answers by updating the GitHub token retrieval mechanism, introducing a new research agent for more comprehensive information gathering, and refactoring tool configurations.
- Update asynchronous token retrieval in search.py and add a new read_github_issues task
- Introduce a new research agent in research_agent.py for Prefect documentation searches
- Refine function name retrieval logic in modules.py and streamline agent configuration in core.py
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| examples/slackbot/search.py | Updates to asynchronous token handling and addition of a read_github_issues task |
| examples/slackbot/research_agent.py | New research agent for improved documentation and issue research |
| examples/slackbot/modules.py | Improved function name fallback logic in display_signature |
| examples/slackbot/core.py | Refactored agent creation to use the new research agent and simplified tool configuration |
| # Load GitHub token synchronously | ||
| github_token = Secret.load(settings.github_token_secret_name, _sync=True).get() # type: ignore | ||
| return asyncio.run( | ||
| search_github_issues(query, repo=repo, n=n, api_token=github_token) | ||
| ) |
There was a problem hiding this comment.
The use of synchronous token loading here differs from the asynchronous approach (via Secret.aload) used elsewhere. Consider unifying the token retrieval pattern to maintain consistency in async contexts.
| # Load GitHub token synchronously | |
| github_token = Secret.load(settings.github_token_secret_name, _sync=True).get() # type: ignore | |
| return asyncio.run( | |
| search_github_issues(query, repo=repo, n=n, api_token=github_token) | |
| ) | |
| # Load GitHub token asynchronously | |
| github_token = await Secret.aload(settings.github_token_secret_name) # type: ignore | |
| return await search_github_issues(query, repo=repo, n=n, api_token=github_token.get()) |
|
|
||
| # Get function name and build header | ||
| func_name = func.__name__ | ||
| func_name = getattr(func, "name", getattr(func, "__name__", "unknown")) |
There was a problem hiding this comment.
[nitpick] This change ensures a fallback for the function name; consider verifying that functions meant for display have a descriptive 'name' attribute to avoid a default value of 'unknown'.
| func_name = getattr(func, "name", getattr(func, "__name__", "unknown")) | |
| func_name = getattr(func, "name", None) or getattr(func, "__name__", "Unnamed Function") |
No description provided.