Skip to content

Conversation

@Muhammad-Elmallah
Copy link
Collaborator

No description provided.

class Splitter:
def __init__(self, split: bool, split_by: str, split_length: int, split_overlap: int):
self.split = split
self.split_by = split_by
Copy link
Contributor

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?

return self.run(data=data)

def upsert(self, documents: List[Record]) -> ModelResponse:
def upsert(self, documents: List[Record], splitter: Splitter = None) -> ModelResponse:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

splitter: Optional[Splitter] = None

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))
Copy link
Contributor

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.


for index in IndexFactory.list()["results"]:
index.delete()
# for index in IndexFactory.list()["results"]:
Copy link
Contributor

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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncomment

@Muhammad-Elmallah Muhammad-Elmallah merged commit f6422db into development Jun 2, 2025
@Muhammad-Elmallah Muhammad-Elmallah deleted the ENG-2040-ai-r-2-add-splitting-features-to-the-sdk branch June 2, 2025 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants