Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions bigframes/bigquery/_operations/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ def generate(
>>> import bigframes.pandas as bpd
>>> import bigframes.bigquery as bbq
>>> country = bpd.Series(["Japan", "Canada"])
>>> bbq.ai.generate(("What's the capital city of ", country, " one word only"))
0 {'result': 'Tokyo\\n', 'full_response': '{"cand...
1 {'result': 'Ottawa\\n', 'full_response': '{"can...
>>> bbq.ai.generate(("What's the capital city of ", country, " one word only")) # doctest: +SKIP
0 {'result': 'Tokyo', 'full_response': '{"cand...
1 {'result': 'Ottawa', 'full_response': '{"can...
dtype: struct<result: string, full_response: extension<dbjson<JSONArrowType>>, status: string>[pyarrow]

>>> bbq.ai.generate(("What's the capital city of ", country, " one word only")).struct.field("result")
0 Tokyo\\n
1 Ottawa\\n
>>> bbq.ai.generate(("What's the capital city of ", country, " one word only")).struct.field("result") # doctest: +SKIP
0 Tokyo
1 Ottawa
Name: result, dtype: string

You get structured output when the `output_schema` parameter is set:
Expand Down
Loading