Skip to content

Commit

Permalink
fix: LLM - Fixed the handling of the TextEmbeddingInput.task_type p…
Browse files Browse the repository at this point in the history
…arameter.

PiperOrigin-RevId: 560854460
  • Loading branch information
vertex-sdk-bot authored and copybara-github committed Aug 28, 2023
1 parent 4f66472 commit 2e3090b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/unit/aiplatform/test_language_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2359,12 +2359,12 @@ def test_text_embedding(self):
{"content": "What is life?"},
{
"content": "Foo",
"taskType": "RETRIEVAL_DOCUMENT",
"task_type": "RETRIEVAL_DOCUMENT",
"title": "Bar",
},
{
"content": "Baz",
"taskType": "CLASSIFICATION",
"task_type": "CLASSIFICATION",
},
]
prediction_parameters = mock_predict.call_args[1]["parameters"]
Expand Down
2 changes: 1 addition & 1 deletion vertexai/language_models/_language_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ def get_embeddings(self,
if isinstance(text, TextEmbeddingInput):
instance = {"content": text.text}
if text.task_type:
instance["taskType"] = text.task_type
instance["task_type"] = text.task_type
if text.title:
instance["title"] = text.title
elif isinstance(text, str):
Expand Down

0 comments on commit 2e3090b

Please sign in to comment.