Skip to content
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

Export Document struct and add Go-idiomatic methods for adding them to a collection #34

Merged
merged 5 commits into from
Mar 4, 2024

Conversation

philippgille
Copy link
Owner

@philippgille philippgille commented Mar 4, 2024

Namely AddDocument() and AddDocuments(), taking the newly exported Document struct as parameter.

This PR also includes some changes of prior "document" mentions to "content" or "text" to avoid misunderstandings.
As well as a refactoring of the error handling in the parallelization code due to two errors requiring handling when documents are added concurrently (and while doing that it made sense to adapt the error handling in the Query method in the same way).

The example code is also changed to use the new methods.

Taking Document objects instead of individual
ids/metadata/embeddings/content parameters.

Move doc metadata copying from constructor to addition to collection,
as we don't use the map before it's added to the collection
To match the refactoring in Collection.AddDocuments
from the previous commit
To differentiate between our now exported Document struct
and its contents.
@philippgille philippgille merged commit ed5dca6 into main Mar 4, 2024
2 checks passed
@philippgille philippgille deleted the add-go-idiomatic-methods branch March 4, 2024 19:29
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.

1 participant