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

Harrison/from methods #1912

Merged
merged 2 commits into from
Mar 23, 2023
Merged

Harrison/from methods #1912

merged 2 commits into from
Mar 23, 2023

Conversation

hwchase17
Copy link
Contributor

No description provided.

shibuiwilliam and others added 2 commits March 22, 2023 20:28
# Why
- Since making vectors of texts can be done outside of langchain Faiss,
this PR is to add functionality to pass text and its vector pair to
initialize and add embedding to Faiss.

# What
- Add `from_embedding` method in Faiss to initialize Faiss index by
passing the embeddings paired with original text made outside of the
langchain.
- Add `add_embedding` method to add embedding paired with original text
to append the embedding made outside of the langchain.
@hwchase17 hwchase17 merged commit eb80d6e into master Mar 23, 2023
@hwchase17 hwchase17 deleted the harrison/from-methods branch March 23, 2023 04:10
baskaryan added a commit that referenced this pull request Oct 19, 2023
- **Description:** Provide a way to use different text for embedding.
- For example, if you are ingesting stack-overflow Q&As for RAG, you
would want to embed the questions and return the answer(s) for the hits.
With this change, the consumer of langchain can implement that easily.
- I noticed the similar function is added on faiss.py with #1912 which
was for performance reason, but I see the same function can be used to
achieve what I thought. So instead of changing Document class to have
embedding_content, I mimicked the implementation of faiss.py.
- The test should provide some guidance on how to use it. It would be
more intuitive if I just pass texts and embedding_texts as separate
arguments, but I chose to use `zip`-ed object for the consistency with
faiss.py implementation.
      - I plan to make similar pull request for OpenSearch.
  - **Issue:** N/A
  - **Dependencies:** None other than the existing ones.

Co-authored-by: Bagatur <baskaryan@gmail.com>
hoanq1811 pushed a commit to hoanq1811/langchain that referenced this pull request Feb 2, 2024
- **Description:** Provide a way to use different text for embedding.
- For example, if you are ingesting stack-overflow Q&As for RAG, you
would want to embed the questions and return the answer(s) for the hits.
With this change, the consumer of langchain can implement that easily.
- I noticed the similar function is added on faiss.py with langchain-ai#1912 which
was for performance reason, but I see the same function can be used to
achieve what I thought. So instead of changing Document class to have
embedding_content, I mimicked the implementation of faiss.py.
- The test should provide some guidance on how to use it. It would be
more intuitive if I just pass texts and embedding_texts as separate
arguments, but I chose to use `zip`-ed object for the consistency with
faiss.py implementation.
      - I plan to make similar pull request for OpenSearch.
  - **Issue:** N/A
  - **Dependencies:** None other than the existing ones.

Co-authored-by: Bagatur <baskaryan@gmail.com>
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.

2 participants