-
Notifications
You must be signed in to change notification settings - Fork 244
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
Ragdaemon #540
Ragdaemon #540
Conversation
@@ -23,6 +23,15 @@ async def run_sample(sample: Sample, cwd: Path | str | None = None) -> dict[str, | |||
) | |||
cwd = Path(repo.working_dir) | |||
|
|||
# Make sure there's a .gitignore file, and that '.ragdaemon/*' is in it |
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.
Consider checking for the presence of .ragdaemon/*
in .gitignore
using a more robust method that accounts for variations in whitespace and comment lines. This current approach might not catch all valid occurrences.
mentat/code_context.py
Outdated
@@ -56,6 +48,12 @@ def __init__( | |||
|
|||
self.diff_context = DiffContext(stream, cwd, self.diff, self.pr_diff) | |||
|
|||
annotators: dict[str, dict[str, Any]] = { |
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.
The removal of ensure_ctags_installed
check in Session
class might impact functionality relying on ctags. Ensure that ragdaemon's functionality fully supersedes or makes unnecessary the use of ctags before removing related checks.
mentat/code_context.py
Outdated
@@ -56,6 +48,12 @@ def __init__( | |||
|
|||
self.diff_context = DiffContext(stream, cwd, self.diff, self.pr_diff) | |||
|
|||
annotators: dict[str, dict[str, Any]] = { |
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.
Given the significant changes in how code context is managed with the introduction of ragdaemon, it's crucial to ensure backward compatibility or provide clear migration paths for existing functionalities, especially those related to code feature extraction and manipulation.
mentat/code_context.py
Outdated
@@ -56,6 +48,12 @@ def __init__( | |||
|
|||
self.diff_context = DiffContext(stream, cwd, self.diff, self.pr_diff) | |||
|
|||
annotators: dict[str, dict[str, Any]] = { |
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.
The transition to using Daemon
from ragdaemon simplifies the handling of code context significantly. However, it's important to document the expected structure and usage patterns of Daemon
for future maintainers and developers.
requirements.txt
Outdated
@@ -29,3 +29,4 @@ typing_extensions==4.8.0 | |||
tqdm==4.66.1 | |||
webdriver_manager==4.0.1 | |||
watchfiles==0.21.0 | |||
git+https://github.com/AbanteAI/ragdaemon.git#egg=ragdaemon |
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.
Ensure that the version of ragdaemon specified here is compatible with the current implementation of Mentat. It might be beneficial to lock to a specific version or range to prevent breaking changes.
@@ -16,6 +16,7 @@ | |||
from tests.conftest import run_git_command | |||
|
|||
|
|||
@pytest.mark.ragdaemon |
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.
Given the introduction of ragdaemon, consider adding tests that specifically cover its integration and interaction with the existing codebase, ensuring that features like auto context and file inclusion/exclusion work as expected.
MENTAT CODE REVIEW IN ACTIVE DEVELOPMENT. Only in use on mentat and internal repos. This PR introduces ragdaemon into Mentat, significantly altering how code context is managed. The changes are foundational and appear to streamline the process by leveraging ragdaemon's capabilities. Key considerations include ensuring backward compatibility, robustness in |
# Make sure there's a .gitignore file, and that '.ragdaemon/*' is in it | ||
gitignore_path = cwd / ".gitignore" | ||
if not gitignore_path.exists(): | ||
gitignore_path.write_text(".ragdaemon/*\n") |
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.
Consider using a more robust method for appending .ragdaemon/*
to .gitignore
. This method should account for potential whitespace variations and ignore any lines that are commented out.
mentat/code_context.py
Outdated
"hierarchy": {"ignore_patterns": [str(p) for p in self.ignore_patterns]}, | ||
"diff": {"diff": self.diff_context.target}, | ||
} | ||
self.daemon: Daemon = Daemon(cwd=cwd, annotators=annotators, verbose=False) |
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.
Ensure comprehensive testing and documentation for the new Daemon-based approach, especially regarding backward compatibility and migration paths for functionalities previously reliant on ctags.
requirements.txt
Outdated
webdriver_manager==4.0.1 | ||
watchfiles==0.21.0 | ||
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon@main |
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.
Consider specifying a version or version range for ragdaemon to ensure compatibility and prevent potential breaking changes.
@@ -16,6 +16,7 @@ | |||
from tests.conftest import run_git_command | |||
|
|||
|
|||
@pytest.mark.ragdaemon |
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.
Add tests that specifically cover the integration of ragdaemon, focusing on functionalities like auto context and file inclusion/exclusion.
# Make sure there's a .gitignore file, and that '.ragdaemon/*' is in it | ||
gitignore_path = cwd / ".gitignore" | ||
if not gitignore_path.exists(): | ||
gitignore_path.write_text(".ragdaemon/*\n") |
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.
Consider using Path
operations for file existence check and content appending to ensure platform independence and readability.
gitignore_path.write_text(".ragdaemon/*\n") | |
if gitignore_path.is_file(): | |
with gitignore_path.open('r+') as f: | |
contents = f.read() | |
if '.ragdaemon/*' not in contents: | |
f.write('.ragdaemon/* | |
') | |
else: | |
gitignore_path.write_text('.ragdaemon/* | |
') |
This approach ensures that the file is only opened once when it exists, and directly writes the text if it doesn't exist.
mentat/code_context.py
Outdated
"hierarchy": {"ignore_patterns": [str(p) for p in self.ignore_patterns]}, | ||
"diff": {"diff": self.diff_context.target}, | ||
} | ||
self.daemon: Daemon = Daemon(cwd=cwd, annotators=annotators, verbose=False) |
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.
It's important to ensure that the Daemon
initialization and its usage do not introduce significant performance overhead, especially in scenarios where the code context or the diff context changes frequently.
Consider adding performance benchmarks to measure the impact of these changes on Mentat's overall performance, particularly for large repositories or files.
requirements.txt
Outdated
webdriver_manager==4.0.1 | ||
watchfiles==0.21.0 | ||
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon@main |
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.
It's recommended to pin ragdaemon
to a specific version or commit to ensure consistent behavior across different environments and prevent unexpected issues due to changes in the ragdaemon
project.
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon@main | |
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon.git@specific_commit_or_tag#egg=ragdaemon |
Replace specific_commit_or_tag
with the desired commit hash or tag.
@@ -16,6 +16,7 @@ | |||
from tests.conftest import run_git_command | |||
|
|||
|
|||
@pytest.mark.ragdaemon |
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.
Given the introduction of ragdaemon
, ensure that the tests cover scenarios where ragdaemon
's behavior might differ from the previous implementation, such as handling of large files, special characters in file names, and complex directory structures.
# Make sure there's a .gitignore file, and that '.ragdaemon/*' is in it | ||
gitignore_path = cwd / ".gitignore" | ||
if not gitignore_path.exists(): | ||
gitignore_path.write_text(".ragdaemon/*\n") |
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.
gitignore_path.write_text(".ragdaemon/*\n") | |
if gitignore_path.is_file(): | |
with gitignore_path.open('r+') as f: | |
contents = f.read() | |
if '.ragdaemon/*' not in contents: | |
f.write('.ragdaemon/* | |
') | |
else: | |
gitignore_path.write_text('.ragdaemon/* | |
') |
Consider using Path
operations for file existence check and content appending to ensure platform independence and readability.
mentat/code_context.py
Outdated
"hierarchy": {"ignore_patterns": [str(p) for p in self.ignore_patterns]}, | ||
"diff": {"diff": self.diff_context.target}, | ||
} | ||
self.daemon: Daemon = Daemon(cwd=cwd, annotators=annotators, verbose=False) |
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.
It's important to ensure that the Daemon
initialization and its usage do not introduce significant performance overhead, especially in scenarios where the code context or the diff context changes frequently.
Consider adding performance benchmarks to measure the impact of these changes on Mentat's overall performance, particularly for large repositories or files.
requirements.txt
Outdated
webdriver_manager==4.0.1 | ||
watchfiles==0.21.0 | ||
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon@main |
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.
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon@main | |
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon.git@specific_commit_or_tag#egg=ragdaemon |
Replace specific_commit_or_tag
with the desired commit hash or tag.
@@ -16,6 +16,7 @@ | |||
from tests.conftest import run_git_command | |||
|
|||
|
|||
@pytest.mark.ragdaemon |
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.
Given the introduction of ragdaemon
, ensure that the tests cover scenarios where ragdaemon
's behavior might differ from the previous implementation, such as handling of large files, special characters in file names, and complex directory structures.
# Make sure there's a .gitignore file, and that '.ragdaemon/*' is in it | ||
gitignore_path = cwd / ".gitignore" | ||
if not gitignore_path.exists(): | ||
gitignore_path.write_text(".ragdaemon/*\n") |
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.
gitignore_path.write_text(".ragdaemon/*\n") | |
if gitignore_path.is_file(): | |
with gitignore_path.open('r+') as f: | |
contents = f.read() | |
if '.ragdaemon/*' not in contents: | |
f.write('.ragdaemon/* | |
') | |
else: | |
gitignore_path.write_text('.ragdaemon/* | |
') |
Consider using Path
operations for file existence check and content appending to ensure platform independence and readability.
@@ -31,6 +31,15 @@ def setup_sample( | |||
) | |||
cwd = Path(repo.working_dir) | |||
|
|||
# Make sure there's a .gitignore file, and that '.ragdaemon/*' is in it | |||
gitignore_path = cwd / ".gitignore" | |||
if not gitignore_path.exists(): |
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.
if not gitignore_path.exists(): | |
if gitignore_path.is_file(): | |
with gitignore_path.open('r+') as f: | |
contents = f.read() | |
if '.ragdaemon/*' not in contents: | |
f.write('.ragdaemon/* | |
') | |
else: | |
gitignore_path.write_text('.ragdaemon/* | |
') |
Consider using Path
operations for file existence check and content appending to ensure platform independence and readability.
@@ -59,6 +58,28 @@ def __init__( | |||
self.include_files: Dict[Path, List[CodeFeature]] = {} | |||
self.ignore_files: Set[Path] = set() | |||
|
|||
async def refresh_daemon(self): |
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.
It's important to ensure that the Daemon
initialization and its usage do not introduce significant performance overhead, especially in scenarios where the code context or the diff context changes frequently.
Consider adding performance benchmarks to measure the impact of these changes on Mentat's overall performance, particularly for large repositories or files.
requirements.txt
Outdated
webdriver_manager==4.0.1 | ||
watchfiles==0.21.0 | ||
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon@main |
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.
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon@main | |
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon.git@specific_commit_or_tag#egg=ragdaemon |
Replace specific_commit_or_tag
with the desired commit hash or tag.
@@ -286,6 +279,9 @@ def temp_testbed(monkeypatch, get_marks): | |||
run_git_command(temp_testbed, "add", ".") | |||
run_git_command(temp_testbed, "commit", "-m", "add testbed") | |||
|
|||
if "ragdaemon" not in get_marks: |
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.
For tests that require a real or simulated ragdaemon
environment, consider setting up a fixture that initializes ragdaemon
with a test configuration. This could involve mocking network calls or using a local instance of the service that ragdaemon
communicates with.
@@ -31,6 +31,15 @@ def setup_sample( | |||
) | |||
cwd = Path(repo.working_dir) | |||
|
|||
# Make sure there's a .gitignore file, and that '.ragdaemon/*' is in it |
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.
# Make sure there's a .gitignore file, and that '.ragdaemon/*' is in it | |
if gitignore_path.is_file(): | |
with gitignore_path.open('r+') as f: | |
contents = f.read() | |
if '.ragdaemon/*' not in contents: | |
f.write('.ragdaemon/* | |
') | |
else: | |
gitignore_path.write_text('.ragdaemon/* | |
') |
Consider using Path
operations for file existence check and content appending to ensure platform independence and readability.
@@ -59,6 +58,28 @@ def __init__( | |||
self.include_files: Dict[Path, List[CodeFeature]] = {} | |||
self.ignore_files: Set[Path] = set() | |||
|
|||
async def refresh_daemon(self): | |||
"""Call before interacting with context to ensure daemon is up to date.""" |
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.
Given the introduction of Daemon
from ragdaemon, it's essential to ensure that all functionalities relying on the previous context management are still supported or have been adapted to work with the new system. This includes auto context tokens, file inclusion/exclusion, and any other features that were previously managed through the code context.
@@ -59,6 +58,28 @@ def __init__( | |||
self.include_files: Dict[Path, List[CodeFeature]] = {} | |||
self.ignore_files: Set[Path] = set() | |||
|
|||
async def refresh_daemon(self): | |||
"""Call before interacting with context to ensure daemon is up to date.""" |
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.
The transition to using Daemon
for managing code context introduces a significant change in how Mentat handles code analysis and feature extraction. It's crucial to document the new process, especially how Daemon
interacts with the rest of the system, to ensure maintainability and ease of future development.
typing_extensions==4.8.0 | ||
tqdm==4.66.1 | ||
tqdm>=4.66.1 |
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.
The direct git dependency on ragdaemon
should specify a commit hash or tag to ensure consistent builds. Depending on the main branch might introduce breaking changes unexpectedly.
tqdm>=4.66.1 | |
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon.git@<commit_hash_or_tag>#egg=ragdaemon |
@@ -286,6 +279,9 @@ def temp_testbed(monkeypatch, get_marks): | |||
run_git_command(temp_testbed, "add", ".") | |||
run_git_command(temp_testbed, "commit", "-m", "add testbed") | |||
|
|||
if "ragdaemon" not in get_marks: | |||
mocker.patch("ragdaemon.daemon.Daemon.update", side_effect=AsyncMock()) | |||
|
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.
For tests that require a real or simulated ragdaemon
environment, consider setting up a fixture that initializes ragdaemon
with a test configuration. This could involve mocking network calls or using a local instance of the service that ragdaemon
communicates with.
@@ -286,6 +279,9 @@ def temp_testbed(monkeypatch, get_marks): | |||
run_git_command(temp_testbed, "add", ".") | |||
run_git_command(temp_testbed, "commit", "-m", "add testbed") | |||
|
|||
if "ragdaemon" not in get_marks: | |||
mocker.patch("ragdaemon.daemon.Daemon.update", side_effect=AsyncMock()) | |||
|
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.
Mocking Daemon.update
in tests is a good approach to isolate unit tests from external dependencies. However, for integration tests or tests marked with @pytest.mark.ragdaemon
, consider strategies to test against a real or simulated ragdaemon environment to cover end-to-end functionality.
MENTAT CODE REVIEW IN ACTIVE DEVELOPMENT. Only in use on mentat and internal repos. The integration of |
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.
Works for me and I appreciate the 600 line reduction. Also sorry about the butler mess I don't handle multiple commits very well right now.
I have a few notes but haven't had time to look at it closely.
async def refresh_daemon(self): | ||
"""Call before interacting with context to ensure daemon is up to date.""" | ||
if not hasattr(self, "daemon"): | ||
# Daemon is initialized after setup because it needs the embedding_provider. |
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.
For me this change increases the startup time form 1s to 2s. Ragdaemon itself takes 0.68 seconds to import and it seems up until this point we only use it for type annotation. Could we import it lazily?
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.
Thanks for bringing this up, Jake. I'll look into lazy loading ragdaemon
to mitigate the impact on startup time. It's crucial to maintain a balance between introducing new functionalities and preserving the performance that users expect from Mentat.
assert count_tokens(code_message, "gpt-4", full_message=True) == 95 # Code | ||
assert ( | ||
code_message | ||
== """\ |
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.
nit: can you use dedent here?
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.
Thanks for the suggestion! I'll incorporate dedent
for better readability of multi-line strings in tests.
@@ -91,6 +91,9 @@ def annotate_file_message(code_message: list[str], annotations: list[DiffAnnotat | |||
|
|||
|
|||
class DiffContext: | |||
target: str = "" |
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.
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.
You're right, the primary use of the diff in Mentat has been for rendering annotations in the code message and displaying information in the tree viewer. With the integration of ragdaemon, which can handle these functionalities more efficiently, it might be worth considering moving this functionality entirely to ragdaemon. This could simplify the codebase and leverage ragdaemon's capabilities more fully.
Regarding the error you encountered with mentat --diff main
, it seems like there might be an issue with how the diff context is being initialized or used in conjunction with ragdaemon. I'll investigate this further to identify the root cause and ensure it's addressed before finalizing the integration. Thanks for pointing this out!
@@ -59,6 +58,28 @@ def __init__( | |||
self.include_files: Dict[Path, List[CodeFeature]] = {} | |||
self.ignore_files: Set[Path] = set() | |||
|
|||
async def refresh_daemon(self): |
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.
Given the concern about the increased startup time due to ragdaemon
import, it's worth considering lazy loading of ragdaemon
to optimize performance. This approach can help maintain a quick startup time while still leveraging ragdaemon
's functionalities when needed.
One way to achieve this could be by using a property decorator that initializes ragdaemon
upon first access. This way, ragdaemon
is only loaded when its functionalities are actually required, potentially reducing unnecessary overhead during startup.
@@ -202,22 +207,40 @@ def func_4(string): | |||
|
|||
code_context = CodeContext( | |||
mock_session_context.stream, | |||
mock_session_context.code_context.diff_context.git_root, | |||
temp_testbed, |
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.
Using dedent
from the textwrap
module can improve readability when dealing with multi-line strings in tests. It allows you to maintain a clean code structure without worrying about leading whitespaces in the string.
temp_testbed, | |
from textwrap import dedent | |
code_message = await code_context.get_code_message(0, prompt="prompt") | |
assert count_tokens(code_message, "gpt-4", full_message=True) == 95 # Code | |
assert ( | |
code_message | |
== dedent(""" | |
Code Files: | |
file_1.py (search-result, user-included) | |
1:def func_1(x, y): | |
2: return x + y | |
3: | |
4:def func_2(): | |
5: return 3 | |
file_2.py (search-result) | |
1:def func_3(a, b, c): | |
2: return a * b ** c | |
3: | |
4:def func_4(string): | |
5: print(string) | |
""" | |
) | |
) |
match_path_with_patterns, | ||
validate_and_format_path, | ||
) | ||
from mentat.interval import parse_intervals, split_intervals_from_path | ||
from mentat.llm_api_handler import count_tokens, get_max_tokens | ||
from mentat.session_context import SESSION_CONTEXT | ||
from mentat.session_stream import SessionStream | ||
from mentat.utils import get_relative_path, mentat_dir_path |
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.
Given the introduction of Daemon
from ragdaemon, it's essential to ensure that all functionalities relying on the previous context management are still supported or have been adapted to work with the new system. This includes auto context tokens, file inclusion/exclusion, and any other features that were previously managed through the code context.
match_path_with_patterns, | ||
validate_and_format_path, | ||
) | ||
from mentat.interval import parse_intervals, split_intervals_from_path | ||
from mentat.llm_api_handler import count_tokens, get_max_tokens | ||
from mentat.session_context import SESSION_CONTEXT | ||
from mentat.session_stream import SessionStream | ||
from mentat.utils import get_relative_path, mentat_dir_path |
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.
The transition to using Daemon
for managing code context introduces a significant change in how Mentat handles code analysis and feature extraction. It's crucial to document the new process, especially how Daemon
interacts with the rest of the system, to ensure maintainability and ease of future development.
requirements.txt
Outdated
@@ -17,6 +17,7 @@ pytest-mock==3.11.1 | |||
pytest-reportlog==0.4.0 | |||
pytest-timeout==2.2.0 | |||
python-dotenv==1.0.0 | |||
ragdaemon==0.1.1 |
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.
The direct git dependency on ragdaemon
should specify a commit hash or tag to ensure consistent builds. Depending on the main branch might introduce breaking changes unexpectedly.
ragdaemon==0.1.1 | |
ragdaemon @ git+https://github.com/AbanteAI/ragdaemon.git@<commit_hash_or_tag>#egg=ragdaemon |
@@ -286,6 +279,9 @@ def temp_testbed(monkeypatch, get_marks): | |||
run_git_command(temp_testbed, "add", ".") | |||
run_git_command(temp_testbed, "commit", "-m", "add testbed") | |||
|
|||
if "ragdaemon" not in get_marks: |
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.
For tests that require a real or simulated ragdaemon
environment, consider setting up a fixture that initializes ragdaemon
with a test configuration. This could involve mocking network calls or using a local instance of the service that ragdaemon
communicates with.
@@ -59,6 +58,28 @@ def __init__( | |||
self.include_files: Dict[Path, List[CodeFeature]] = {} | |||
self.ignore_files: Set[Path] = set() | |||
|
|||
async def refresh_daemon(self): |
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.
The introduction of annotators
and Daemon
from ragdaemon simplifies handling code context. Ensure comprehensive testing, especially for edge cases that might arise from this new approach.
This aims to be the simplest possible integration of ragdaemon into mentat:
include_files
,CodeFeature
andcode_file_manager
are relatively undisturbed for simplicity. In future PRs we might refactor these to take better advantage of ragdaemon.@pytest.mark.ragdaemon
flag, which will use (and cache) embeddings with chroma. Longer term this should also be mocked out, or tests of that functionality moved to the ragdaemon repo.Pull Request Checklist