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

community: Instantiate GPT4AllEmbeddings with parameters #21238

Conversation

Alex-J-W
Copy link
Contributor

@Alex-J-W Alex-J-W commented May 3, 2024

GPT4AllEmbeddings parameters


Description:
As of right now the Embed4All class inside GPT4AllEmbeddings is instantiated as it's default which leaves no room to customize the chosen model and it's behavior. Thus:

  • GPT4AllEmbeddings can now be instantiated with custom parameters like a different model that shall be used.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 3, 2024
Copy link

vercel bot commented May 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview May 8, 2024 7:16am

@dosubot dosubot bot added Ɑ: embeddings Related to text embedding models module 🤖:improvement Medium size change to existing code to handle new use-cases labels May 3, 2024
@Alex-J-W Alex-J-W force-pushed the enh/allow-set-gpt4allembeddings-parameters branch 4 times, most recently from edfc20c to 382a9cc Compare May 6, 2024 06:02
@@ -19,14 +19,32 @@ class GPT4AllEmbeddings(BaseModel, Embeddings):

client: Any #: :meta private:

def __init__(
Copy link
Contributor

Choose a reason for hiding this comment

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

whats this needed for?

Copy link
Contributor Author

@Alex-J-W Alex-J-W May 7, 2024

Choose a reason for hiding this comment

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

  • I am not used to pydantic. Updated the PR to adopt the pydantic BaseModel convention and removed the __init__.
  • Edited the docstring based on what i have seen in huggingface.py.

@Alex-J-W Alex-J-W force-pushed the enh/allow-set-gpt4allembeddings-parameters branch from 382a9cc to 92059b5 Compare May 7, 2024 08:00
@Alex-J-W Alex-J-W force-pushed the enh/allow-set-gpt4allembeddings-parameters branch from b23e084 to d98db97 Compare May 8, 2024 07:15
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label May 8, 2024
@hwchase17 hwchase17 merged commit d3ce6aa into langchain-ai:master May 8, 2024
60 checks passed
kyle-cassidy pushed a commit to kyle-cassidy/langchain that referenced this pull request May 10, 2024
…i#21238)

### GPT4AllEmbeddings parameters
---

**Description:** 
As of right now the **Embed4All** class inside _GPT4AllEmbeddings_ is
instantiated as it's default which leaves no room to customize the
chosen model and it's behavior. Thus:

- GPT4AllEmbeddings can now be instantiated with custom parameters like
a different model that shall be used.

---------

Co-authored-by: AlexJauchWalser <alexander.jauch-walser@knime.com>
ccurme pushed a commit that referenced this pull request Aug 7, 2024
…gpt4all_kwargs (#25124)

- **Description:** Instantiating `GPT4AllEmbeddings` with no
`gpt4all_kwargs` argument raised a `ValidationError`. Root cause: #21238
added the capability to pass `gpt4all_kwargs` through to the `GPT4All`
instance via `Embed4All`, but broke code that did not specify a
`gpt4all_kwargs` argument.
- **Issue:** #25119 
- **Dependencies:** None
- **Twitter handle:** [`@metadaddy`](https://twitter.com/metadaddy)
olgamurraft pushed a commit to olgamurraft/langchain that referenced this pull request Aug 16, 2024
…gpt4all_kwargs (langchain-ai#25124)

- **Description:** Instantiating `GPT4AllEmbeddings` with no
`gpt4all_kwargs` argument raised a `ValidationError`. Root cause: langchain-ai#21238
added the capability to pass `gpt4all_kwargs` through to the `GPT4All`
instance via `Embed4All`, but broke code that did not specify a
`gpt4all_kwargs` argument.
- **Issue:** langchain-ai#25119 
- **Dependencies:** None
- **Twitter handle:** [`@metadaddy`](https://twitter.com/metadaddy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ɑ: embeddings Related to text embedding models module 🤖:improvement Medium size change to existing code to handle new use-cases lgtm PR looks good. Use to confirm that a PR is ready for merging. size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants