gnovack-amzn
commited on
Commit
•
a2b7e77
1
Parent(s):
f312c15
Update README.md
Browse files
README.md
CHANGED
@@ -6794,9 +6794,9 @@ model-index:
|
|
6794 |
---
|
6795 |
|
6796 |
## Bedrock Titan Text Embeddings v2
|
6797 |
-
This repository contains the MTEB scores and usage examples of Bedrock Titan Text Embeddings v2. You can use the embedding model either via the Bedrock
|
6798 |
|
6799 |
-
## Using Bedrock's
|
6800 |
|
6801 |
```python
|
6802 |
import json
|
@@ -6805,7 +6805,7 @@ class TitanEmbeddings(object):
|
|
6805 |
accept = "application/json"
|
6806 |
content_type = "application/json"
|
6807 |
|
6808 |
-
def __init__(self, model_id="amazon.titan-embed-text-v2"):
|
6809 |
self.bedrock = boto3.client(service_name='bedrock-runtime')
|
6810 |
self.model_id = model_id
|
6811 |
def __call__(self, text, dimensions, normalize=True):
|
@@ -6837,7 +6837,7 @@ if __name__ == '__main__':
|
|
6837 |
dimensions = 1024
|
6838 |
normalize = True
|
6839 |
|
6840 |
-
titan_embeddings_v2 = TitanEmbeddings(model_id="amazon.titan-embed-text-v2")
|
6841 |
|
6842 |
input_text = "What are the different services that you offer?"
|
6843 |
embedding = titan_embeddings_v2(input_text, dimensions, normalize)
|
@@ -6870,7 +6870,7 @@ payload = {
|
|
6870 |
}
|
6871 |
},
|
6872 |
"jobName": "embeddings-v2-batch-job",
|
6873 |
-
"modelId": "amazon.titan-embed-text-v2",
|
6874 |
"outputDataConfig": {
|
6875 |
"s3OutputDataConfig": {
|
6876 |
"s3Uri": "s3://my-output-bucket/batch-output/"
|
|
|
6794 |
---
|
6795 |
|
6796 |
## Bedrock Titan Text Embeddings v2
|
6797 |
+
This repository contains the MTEB scores and usage examples of Bedrock Titan Text Embeddings v2. You can use the embedding model either via the Bedrock InvokeModel API or via Bedrock's batch jobs. For RAG use cases we recommend the former to embed queries during search (latency optimized) and the latter to index corpus (throughput optimized).
|
6798 |
|
6799 |
+
## Using Bedrock's InvokeModel API
|
6800 |
|
6801 |
```python
|
6802 |
import json
|
|
|
6805 |
accept = "application/json"
|
6806 |
content_type = "application/json"
|
6807 |
|
6808 |
+
def __init__(self, model_id="amazon.titan-embed-text-v2:0"):
|
6809 |
self.bedrock = boto3.client(service_name='bedrock-runtime')
|
6810 |
self.model_id = model_id
|
6811 |
def __call__(self, text, dimensions, normalize=True):
|
|
|
6837 |
dimensions = 1024
|
6838 |
normalize = True
|
6839 |
|
6840 |
+
titan_embeddings_v2 = TitanEmbeddings(model_id="amazon.titan-embed-text-v2:0")
|
6841 |
|
6842 |
input_text = "What are the different services that you offer?"
|
6843 |
embedding = titan_embeddings_v2(input_text, dimensions, normalize)
|
|
|
6870 |
}
|
6871 |
},
|
6872 |
"jobName": "embeddings-v2-batch-job",
|
6873 |
+
"modelId": "amazon.titan-embed-text-v2:0",
|
6874 |
"outputDataConfig": {
|
6875 |
"s3OutputDataConfig": {
|
6876 |
"s3Uri": "s3://my-output-bucket/batch-output/"
|