Skip to content

Commit 1e7cba4

Browse files
committed
Update ChainDeployment.
1 parent ca59d5b commit 1e7cba4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ads/llm/deploy.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,19 @@
1919

2020

2121
class ChainDeployment(GenericModel):
22+
"""Represents a model deployment with LangChain.
23+
"""
2224
def __init__(self, chain, **kwargs):
2325
self.chain = chain
26+
if "model_input_serializer" not in kwargs:
27+
kwargs["model_input_serializer"] = self.model_input_serializer_type.JSON
2428
super().__init__(**kwargs)
2529

2630
def prepare(self, **kwargs) -> GenericModel:
2731
"""Prepares the model artifact."""
2832
chain_yaml_uri = os.path.join(self.artifact_dir, "chain.yaml")
33+
if not os.path.exists(self.artifact_dir):
34+
os.makedirs(self.artifact_dir)
2935
with open(chain_yaml_uri, "w", encoding="utf-8") as f:
3036
f.write(yaml.safe_dump(dump(self.chain)))
3137

0 commit comments

Comments
 (0)