File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
ads/llm/langchain/plugins Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -56,10 +56,12 @@ def is_lc_serializable(cls) -> bool:
56
56
57
57
58
58
class GenerativeAiClientModel (BaseModel ):
59
+ """Base model for generative AI embedding model and LLM."""
60
+
59
61
client : Any #: :meta private:
60
62
"""OCI GenerativeAiClient."""
61
63
62
- compartment_id : str
64
+ compartment_id : str = None
63
65
"""Compartment ID of the caller."""
64
66
65
67
endpoint_kwargs : Dict [str , Any ] = {}
@@ -90,7 +92,9 @@ def validate_environment( # pylint: disable=no-self-argument
90
92
client_kwargs .update (values ["client_kwargs" ])
91
93
values ["client" ] = GenerativeAiClient (** auth , ** client_kwargs )
92
94
# Set default compartment ID
93
- if "compartment_id" not in values and COMPARTMENT_OCID :
94
- values ["compartment_id" ] = COMPARTMENT_OCID
95
-
95
+ if not values .get ("compartment_id" ):
96
+ if COMPARTMENT_OCID :
97
+ values ["compartment_id" ] = COMPARTMENT_OCID
98
+ else :
99
+ raise ValueError ("Please specify compartment_id." )
96
100
return values
You can’t perform that action at this time.
0 commit comments