-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Diwank Tomer <[email protected]>
- Loading branch information
Diwank Tomer
committed
Aug 10, 2024
1 parent
128f074
commit e0c3140
Showing
19 changed files
with
615 additions
and
242 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
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
44 changes: 44 additions & 0 deletions
44
agents-api/migrations/migrate_1723307805_add_lsh_index_to_docs.py
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,44 @@ | ||
#/usr/bin/env python3 | ||
|
||
MIGRATION_ID = "add_lsh_index_to_docs" | ||
CREATED_AT = 1723307805.007054 | ||
|
||
# See: https://docs.cozodb.org/en/latest/vector.html#full-text-search-fts | ||
snippets_lsh_index = dict( | ||
up=""" | ||
::lsh create snippets:lsh { | ||
extractor: content, | ||
tokenizer: Simple, | ||
filters: [Stopwords('en')], | ||
n_perm: 200, | ||
target_threshold: 0.9, | ||
n_gram: 3, | ||
false_positive_weight: 1.0, | ||
false_negative_weight: 1.0, | ||
} | ||
""", | ||
down=""" | ||
::lsh drop snippets:lsh | ||
""", | ||
) | ||
|
||
queries = [ | ||
snippets_lsh_index, | ||
] | ||
|
||
|
||
def run(client, queries): | ||
joiner = "}\n\n{" | ||
|
||
query = joiner.join(queries) | ||
query = f"{{\n{query}\n}}" | ||
|
||
client.run(query) | ||
|
||
|
||
def up(client): | ||
run(client, [q["up"] for q in queries]) | ||
|
||
|
||
def down(client): | ||
run(client, [q["down"] for q in reversed(queries)]) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.