File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
ads/llm/langchain/plugins Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 5
5
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
6
7
7
from typing import List , Optional
8
-
8
+ from langchain . load . serializable import Serializable
9
9
from langchain .schema .embeddings import Embeddings
10
10
from ads .llm .langchain .plugins .base import GenerativeAiClientModel
11
11
12
12
13
- class GenerativeAIEmbeddings (GenerativeAiClientModel , Embeddings ):
13
+ class GenerativeAIEmbeddings (GenerativeAiClientModel , Embeddings , Serializable ):
14
14
"""OCI Generative AI embedding models."""
15
15
16
16
model : str = "cohere.embed-english-light-v2.0"
@@ -19,6 +19,16 @@ class GenerativeAIEmbeddings(GenerativeAiClientModel, Embeddings):
19
19
truncate : Optional [str ] = None
20
20
"""Truncate embeddings that are too long from start or end ("NONE"|"START"|"END")"""
21
21
22
+ @classmethod
23
+ def get_lc_namespace (cls ) -> List [str ]:
24
+ """Get the namespace of the LangChain object."""
25
+ return ["ads" , "llm" ]
26
+
27
+ @classmethod
28
+ def is_lc_serializable (cls ) -> bool :
29
+ """This class can be serialized with default LangChain serialization."""
30
+ return True
31
+
22
32
def embed_documents (self , texts : List [str ]) -> List [List [float ]]:
23
33
"""Embeds a list of strings.
24
34
You can’t perform that action at this time.
0 commit comments