-
Notifications
You must be signed in to change notification settings - Fork 19
Eng 2040 ai r 2 add splitting features to the sdk #546
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
Eng 2040 ai r 2 add splitting features to the sdk #546
Conversation
class Splitter: | ||
def __init__(self, split: bool, split_by: str, split_length: int, split_overlap: int): | ||
self.split = split | ||
self.split_by = split_by |
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 split_by an enumerator. Should it have a default value?
Should split_length and split_overlap have a default value?
@@ -144,25 +152,39 @@ def search(self, query: str, top_k: int = 10, filters: List[IndexFilter] = []) - | |||
} | |||
return self.run(data=data) | |||
|
|||
def upsert(self, documents: List[Record]) -> ModelResponse: | |||
def upsert(self, documents: List[Record], splitter: Splitter = None) -> ModelResponse: |
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.
splitter: Optional[Splitter] = None
|
||
Returns: | ||
ModelResponse: Response from the indexing service | ||
|
||
Example: | ||
index_model.upsert([Record(value="Hello, world!", value_type="text", uri="", id="1", attributes={})]) | ||
index_model.upsert([Record(value="Hello, world!", value_type="text", uri="", id="1", attributes={})], splitter=Splitter(split=True, split_by="word", split_length=1, split_overlap=0)) |
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.
Explain in a line what the splitter does in this example.
@@ -149,8 +150,8 @@ def test_index_model_with_filter(embedding_model, supplier_params): | |||
from aixplain.factories import IndexFactory | |||
from aixplain.modules.model.index_model import IndexFilter, IndexFilterOperator | |||
|
|||
for index in IndexFactory.list()["results"]: | |||
index.delete() | |||
# for index in IndexFactory.list()["results"]: |
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.
Uncomment
for index in IndexFactory.list()["results"]: | ||
index.delete() | ||
# for index in IndexFactory.list()["results"]: | ||
# index.delete() |
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.
Uncomment
No description provided.