mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
fix(vertex_and_google_ai_studio.py): preserve vertex response id
This commit is contained in:
parent
4749008fbe
commit
079d397c6d
2 changed files with 6 additions and 2 deletions
|
|
@ -1230,7 +1230,9 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
|
|||
)
|
||||
|
||||
model_response.choices = []
|
||||
model_response.id = completion_response.get("responseId", None)
|
||||
response_id = completion_response.get("responseId")
|
||||
if response_id:
|
||||
model_response.id = response_id
|
||||
url_context_metadata: List[dict] = []
|
||||
try:
|
||||
grounding_metadata: List[dict] = []
|
||||
|
|
@ -1848,7 +1850,8 @@ class ModelResponseIterator:
|
|||
from litellm.types.utils import ModelResponseStream
|
||||
|
||||
processed_chunk = GenerateContentResponseBody(**chunk) # type: ignore
|
||||
model_response = ModelResponseStream(choices=[])
|
||||
response_id = processed_chunk.get("responseId")
|
||||
model_response = ModelResponseStream(choices=[], id=response_id)
|
||||
usage: Optional[Usage] = None
|
||||
_candidates: Optional[List[Candidates]] = processed_chunk.get("candidates")
|
||||
grounding_metadata: List[dict] = []
|
||||
|
|
|
|||
|
|
@ -377,6 +377,7 @@ class GenerateContentResponseBody(TypedDict, total=False):
|
|||
candidates: List[Candidates]
|
||||
promptFeedback: PromptFeedback
|
||||
usageMetadata: Required[UsageMetadata]
|
||||
responseId: str
|
||||
|
||||
|
||||
class FineTuneHyperparameters(TypedDict, total=False):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue