Skip to content

Commit

Permalink
Fix VertexAI unittest failure due to SDK changes.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 696637774
  • Loading branch information
daiyip authored and langfun authors committed Nov 14, 2024
1 parent 5d5be83 commit 5fc599e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions langfun/core/llms/vertexai_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ def test_generation_config(self):
# There is a discrepancy between the `property_ordering` in the
# Google-internal version and the open-source version.
actual['response_schema'].pop('property_ordering', None)
if pg.KeyPath('response_schema.type_').get(actual):
actual['response_schema']['type'] = actual['response_schema'].pop('type_')
if 'type_' in actual['response_schema']:
actual['response_schema']['type'] = actual['response_schema'].pop('type_')
if 'type_' in actual['response_schema']['properties']['name']:
actual['response_schema']['properties']['name'][
'type'
] = actual['response_schema']['properties']['name'].pop('type_')

self.assertEqual(
actual,
dict(
Expand All @@ -209,9 +218,9 @@ def test_generation_config(self):
stop_sequences=['\n'],
response_mime_type='application/json',
response_schema={
'type_': 'OBJECT',
'type': 'OBJECT',
'properties': {
'name': {'type_': 'STRING'}
'name': {'type': 'STRING'}
},
'required': ['name'],
'title': 'Person',
Expand Down

0 comments on commit 5fc599e

Please sign in to comment.