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

Determine embedding size with Titan Embedding v2 model #39

Merged
merged 1 commit into from May 17, 2024

Conversation

bigbernnn
Copy link
Contributor

Support for Titan Embedding v2 with changing embedding sizes based on this blog. This change lets the user specify dimension.

from langchain_aws.embeddings import BedrockEmbeddings

prompt_data = """Priority should be funding retirement through ROTH/IRA/401K over HSA extra.  
You need to fund your HSA for reasonable and expected medical expenses. """

bedrock_embedding_model_id = "amazon.titan-embed-text-v2:0"

embed_model = BedrockEmbeddings(model_id=bedrock_embedding_model_id)
response = embed_model.embed_documents([prompt_data], 256, True) 
response = embed_model.embed_query(prompt_data, 512, True)

Copy link
Collaborator

@3coins 3coins left a comment

Choose a reason for hiding this comment

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

Looks good!

@3coins 3coins merged commit 622756c into langchain-ai:main May 17, 2024
12 checks passed
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.

None yet

2 participants