mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-17 10:13:29 +00:00
VertexAI now allows to tune codey models (#10367)
Description: VertexAI now supports to tune codey models, I adapted the Vertex AI LLM wrapper accordingly https://cloud.google.com/vertex-ai/docs/generative-ai/models/tune-code-models
This commit is contained in:
parent
1b0eebe1e3
commit
5a4ce9ef2b
@ -169,7 +169,7 @@ class VertexAI(_VertexAICommon, LLM):
|
||||
tuned_model_name = values.get("tuned_model_name")
|
||||
model_name = values["model_name"]
|
||||
try:
|
||||
if tuned_model_name or not is_codey_model(model_name):
|
||||
if not is_codey_model(model_name):
|
||||
from vertexai.preview.language_models import TextGenerationModel
|
||||
|
||||
if tuned_model_name:
|
||||
@ -181,7 +181,12 @@ class VertexAI(_VertexAICommon, LLM):
|
||||
else:
|
||||
from vertexai.preview.language_models import CodeGenerationModel
|
||||
|
||||
values["client"] = CodeGenerationModel.from_pretrained(model_name)
|
||||
if tuned_model_name:
|
||||
values["client"] = CodeGenerationModel.get_tuned_model(
|
||||
tuned_model_name
|
||||
)
|
||||
else:
|
||||
values["client"] = CodeGenerationModel.from_pretrained(model_name)
|
||||
except ImportError:
|
||||
raise_vertex_import_error()
|
||||
return values
|
||||
|
Loading…
Reference in New Issue
Block a user