-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
360 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from moatless.benchmark.swebench import setup_swebench_repo | ||
from moatless.benchmark.utils import get_moatless_instance | ||
from moatless.index import IndexSettings, CodeIndex | ||
from moatless.index.settings import CommentStrategy | ||
from moatless.repository import GitRepository, FileRepository | ||
|
||
|
||
def test_ingestion(): | ||
index_settings = IndexSettings( | ||
embed_model="voyage-code-2", | ||
dimensions=1536, | ||
language="python", | ||
min_chunk_size=200, | ||
chunk_size=750, | ||
hard_token_limit=3000, | ||
max_chunks=200, | ||
comment_strategy=CommentStrategy.ASSOCIATE, | ||
) | ||
|
||
instance_id = "django__django-12419" | ||
instance = get_moatless_instance(instance_id, split="verified") | ||
repo_dir = setup_swebench_repo(instance) | ||
print(repo_dir) | ||
repo = FileRepository(repo_dir) | ||
code_index = CodeIndex(settings=index_settings, file_repo=repo) | ||
|
||
vectors, indexed_tokens = code_index.run_ingestion(num_workers=1, input_files=["django/conf/global_settings.py"]) | ||
|
||
results = code_index._vector_search("SECURE_REFERRER_POLICY setting") | ||
|
||
for result in results: | ||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
|
||
from llama_index.core.vector_stores import VectorStoreQuery | ||
|
||
from moatless.index import SimpleFaissVectorStore | ||
|
||
|
||
def test_search_index(): | ||
index_store_dir = os.getenv("INDEX_STORE_DIR") | ||
vector_store = SimpleFaissVectorStore.from_persist_dir(f"{index_store_dir}/django__django-12419") | ||
|
||
query_bundle = VectorStoreQuery( | ||
query_str="SECURE_REFERRER_POLICY setting", | ||
similarity_top_k=100, | ||
) | ||
|
||
result = vector_store.query(query_bundle) | ||
for res in result.ids: | ||
print(res) |
Oops, something went wrong.