Skip to content

Commit d85894f

Browse files
committed
remove doctest:skip as the entire file's doctests have been ignored
1 parent 2cc6186 commit d85894f

1 file changed

Lines changed: 66 additions & 66 deletions

File tree

  • packages/bigframes/bigframes/bigquery/_operations

packages/bigframes/bigframes/bigquery/_operations/ai.py

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,23 @@ def generate(
5757
5858
**Examples:**
5959
60-
>>> import bigframes.pandas as bpd # doctest: +SKIP
61-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
62-
>>> country = bpd.Series(["Japan", "Canada"]) # doctest: +SKIP
63-
>>> bbq.ai.generate(("What's the capital city of ", country, " one word only")) # doctest: +SKIP
60+
>>> import bigframes.pandas as bpd
61+
>>> import bigframes.bigquery as bbq
62+
>>> country = bpd.Series(["Japan", "Canada"])
63+
>>> bbq.ai.generate(("What's the capital city of ", country, " one word only"))
6464
0 {'result': 'Tokyo', 'full_response': '{"cand...
6565
1 {'result': 'Ottawa', 'full_response': '{"can...
6666
dtype: struct<result: string, full_response: extension<dbjson<JSONArrowType>>, status: string>[pyarrow]
6767
68-
>>> bbq.ai.generate(("What's the capital city of ", country, " one word only")).struct.field("result") # doctest: +SKIP
68+
>>> bbq.ai.generate(("What's the capital city of ", country, " one word only")).struct.field("result")
6969
0 Tokyo
7070
1 Ottawa
7171
Name: result, dtype: string
7272
7373
You get structured output when the ``output_schema`` parameter is set:
7474
75-
>>> animals = bpd.Series(["Rabbit", "Spider"]) # doctest: +SKIP
76-
>>> bbq.ai.generate(animals, output_schema={"number_of_legs": "INT64", "is_herbivore": "BOOL"}) # doctest: +SKIP
75+
>>> animals = bpd.Series(["Rabbit", "Spider"])
76+
>>> bbq.ai.generate(animals, output_schema={"number_of_legs": "INT64", "is_herbivore": "BOOL"})
7777
0 {'is_herbivore': True, 'number_of_legs': 4, 'f...
7878
1 {'is_herbivore': False, 'number_of_legs': 8, '...
7979
dtype: struct<is_herbivore: bool, number_of_legs: int64, full_response: extension<dbjson<JSONArrowType>>, status: string>[pyarrow]
@@ -151,19 +151,19 @@ def generate_bool(
151151
152152
**Examples:**
153153
154-
>>> import bigframes.pandas as bpd # doctest: +SKIP
155-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
154+
>>> import bigframes.pandas as bpd
155+
>>> import bigframes.bigquery as bbq
156156
>>> df = bpd.DataFrame({
157157
... "col_1": ["apple", "bear", "pear"],
158158
... "col_2": ["fruit", "animal", "animal"]
159-
... }) # doctest: +SKIP
160-
>>> bbq.ai.generate_bool((df["col_1"], " is a ", df["col_2"])) # doctest: +SKIP
159+
... })
160+
>>> bbq.ai.generate_bool((df["col_1"], " is a ", df["col_2"]))
161161
0 {'result': True, 'full_response': '{"candidate...
162162
1 {'result': True, 'full_response': '{"candidate...
163163
2 {'result': False, 'full_response': '{"candidat...
164164
dtype: struct<result: bool, full_response: extension<dbjson<JSONArrowType>>, status: string>[pyarrow]
165165
166-
>>> bbq.ai.generate_bool((df["col_1"], " is a ", df["col_2"])).struct.field("result") # doctest: +SKIP
166+
>>> bbq.ai.generate_bool((df["col_1"], " is a ", df["col_2"])).struct.field("result")
167167
0 True
168168
1 True
169169
2 False
@@ -228,16 +228,16 @@ def generate_int(
228228
229229
**Examples:**
230230
231-
>>> import bigframes.pandas as bpd # doctest: +SKIP
232-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
233-
>>> animal = bpd.Series(["Kangaroo", "Rabbit", "Spider"]) # doctest: +SKIP
234-
>>> bbq.ai.generate_int(("How many legs does a ", animal, " have?")) # doctest: +SKIP
231+
>>> import bigframes.pandas as bpd
232+
>>> import bigframes.bigquery as bbq
233+
>>> animal = bpd.Series(["Kangaroo", "Rabbit", "Spider"])
234+
>>> bbq.ai.generate_int(("How many legs does a ", animal, " have?"))
235235
0 {'result': 2, 'full_response': '{"candidates":...
236236
1 {'result': 4, 'full_response': '{"candidates":...
237237
2 {'result': 8, 'full_response': '{"candidates":...
238238
dtype: struct<result: int64, full_response: extension<dbjson<JSONArrowType>>, status: string>[pyarrow]
239239
240-
>>> bbq.ai.generate_int(("How many legs does a ", animal, " have?")).struct.field("result") # doctest: +SKIP
240+
>>> bbq.ai.generate_int(("How many legs does a ", animal, " have?")).struct.field("result")
241241
0 2
242242
1 4
243243
2 8
@@ -302,16 +302,16 @@ def generate_double(
302302
303303
**Examples:**
304304
305-
>>> import bigframes.pandas as bpd # doctest: +SKIP
306-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
307-
>>> animal = bpd.Series(["Kangaroo", "Rabbit", "Spider"]) # doctest: +SKIP
308-
>>> bbq.ai.generate_double(("How many legs does a ", animal, " have?")) # doctest: +SKIP
305+
>>> import bigframes.pandas as bpd
306+
>>> import bigframes.bigquery as bbq
307+
>>> animal = bpd.Series(["Kangaroo", "Rabbit", "Spider"])
308+
>>> bbq.ai.generate_double(("How many legs does a ", animal, " have?"))
309309
0 {'result': 2.0, 'full_response': '{"candidates...
310310
1 {'result': 4.0, 'full_response': '{"candidates...
311311
2 {'result': 8.0, 'full_response': '{"candidates...
312312
dtype: struct<result: double, full_response: extension<dbjson<JSONArrowType>>, status: string>[pyarrow]
313313
314-
>>> bbq.ai.generate_double(("How many legs does a ", animal, " have?")).struct.field("result") # doctest: +SKIP
314+
>>> bbq.ai.generate_double(("How many legs does a ", animal, " have?")).struct.field("result")
315315
0 2.0
316316
1 4.0
317317
2 8.0
@@ -379,13 +379,13 @@ def generate_embedding(
379379
380380
**Examples:**
381381
382-
>>> import bigframes.pandas as bpd # doctest: +SKIP
383-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
384-
>>> df = bpd.DataFrame({"content": ["apple", "bear", "pear"]}) # doctest: +SKIP
382+
>>> import bigframes.pandas as bpd
383+
>>> import bigframes.bigquery as bbq
384+
>>> df = bpd.DataFrame({"content": ["apple", "bear", "pear"]})
385385
>>> bbq.ai.generate_embedding(
386386
... "project.dataset.model_name",
387387
... df
388-
... ) # doctest: +SKIP
388+
... )
389389
390390
Args:
391391
model (ml_base.BaseEstimator or str):
@@ -482,13 +482,13 @@ def generate_text(
482482
483483
**Examples:**
484484
485-
>>> import bigframes.pandas as bpd # doctest: +SKIP
486-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
487-
>>> df = bpd.DataFrame({"prompt": ["write a poem about apples"]}) # doctest: +SKIP
485+
>>> import bigframes.pandas as bpd
486+
>>> import bigframes.bigquery as bbq
487+
>>> df = bpd.DataFrame({"prompt": ["write a poem about apples"]})
488488
>>> bbq.ai.generate_text(
489489
... "project.dataset.model_name",
490490
... df
491-
... ) # doctest: +SKIP
491+
... )
492492
493493
Args:
494494
model (ml_base.BaseEstimator or str):
@@ -594,17 +594,17 @@ def generate_table(
594594
595595
**Examples:**
596596
597-
>>> import bigframes.pandas as bpd # doctest: +SKIP
598-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
597+
>>> import bigframes.pandas as bpd
598+
>>> import bigframes.bigquery as bbq
599599
>>> # The user is responsible for constructing a DataFrame that contains
600600
>>> # the necessary columns for the model's prompt. For example, a
601601
>>> # DataFrame with a 'prompt' column for text classification.
602-
>>> df = bpd.DataFrame({'prompt': ["some text to classify"]}) # doctest: +SKIP
602+
>>> df = bpd.DataFrame({'prompt': ["some text to classify"]})
603603
>>> result = bbq.ai.generate_table(
604604
... "project.dataset.model_name",
605605
... data=df,
606606
... output_schema="category STRING"
607-
... ) # doctest: +SKIP
607+
... )
608608
609609
Args:
610610
model (ml_base.BaseEstimator or str):
@@ -705,13 +705,13 @@ def embed(
705705
706706
**Examples:**
707707
708-
>>> import bigframes.pandas as bpd # doctest: +SKIP
709-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
710-
>>> bbq.ai.embed("dog", endpoint="text-embedding-005") # doctest: +SKIP
708+
>>> import bigframes.pandas as bpd
709+
>>> import bigframes.bigquery as bbq
710+
>>> bbq.ai.embed("dog", endpoint="text-embedding-005")
711711
0 {'result': array([ 1.78243860e-03, -1.10658340...
712712
713-
>>> s = bpd.Series(['dog']) # doctest: +SKIP
714-
>>> bbq.ai.embed(s, endpoint='text-embedding-005') # doctest: +SKIP
713+
>>> s = bpd.Series(['dog'])
714+
>>> bbq.ai.embed(s, endpoint='text-embedding-005')
715715
0 {'result': array([ 1.78243860e-03, -1.10658340...
716716
717717
Args:
@@ -784,16 +784,16 @@ def if_(
784784
785785
**Examples:**
786786
787-
>>> import bigframes.pandas as bpd # doctest: +SKIP
788-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
789-
>>> us_state = bpd.Series(["Massachusetts", "Illinois", "Hawaii"]) # doctest: +SKIP
790-
>>> bbq.ai.if_((us_state, " has a city called Springfield")) # doctest: +SKIP
787+
>>> import bigframes.pandas as bpd
788+
>>> import bigframes.bigquery as bbq
789+
>>> us_state = bpd.Series(["Massachusetts", "Illinois", "Hawaii"])
790+
>>> bbq.ai.if_((us_state, " has a city called Springfield"))
791791
0 True
792792
1 True
793793
2 False
794794
dtype: boolean
795795
796-
>>> us_state[bbq.ai.if_((us_state, " has a city called Springfield"))] # doctest: +SKIP
796+
>>> us_state[bbq.ai.if_((us_state, " has a city called Springfield"))]
797797
0 Massachusetts
798798
1 Illinois
799799
dtype: string
@@ -853,11 +853,11 @@ def classify(
853853
854854
**Examples:**
855855
856-
>>> import bigframes.pandas as bpd # doctest: +SKIP
857-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
858-
>>> df = bpd.DataFrame({'creature': ['Cat', 'Salmon']}) # doctest: +SKIP
859-
>>> df['type'] = bbq.ai.classify(df['creature'], ['Mammal', 'Fish']) # doctest: +SKIP
860-
>>> df # doctest: +SKIP
856+
>>> import bigframes.pandas as bpd
857+
>>> import bigframes.bigquery as bbq
858+
>>> df = bpd.DataFrame({'creature': ['Cat', 'Salmon']})
859+
>>> df['type'] = bbq.ai.classify(df['creature'], ['Mammal', 'Fish'])
860+
>>> df
861861
creature type
862862
0 Cat Mammal
863863
1 Salmon Fish
@@ -926,10 +926,10 @@ def score(
926926
927927
**Examples:**
928928
929-
>>> import bigframes.pandas as bpd # doctest: +SKIP
930-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
931-
>>> animal = bpd.Series(["Tiger", "Rabbit", "Blue Whale"]) # doctest: +SKIP
932-
>>> bbq.ai.score(("Rank the relative weights of ", animal, " on the scale from 1 to 3")) # doctest: +SKIP
929+
>>> import bigframes.pandas as bpd
930+
>>> import bigframes.bigquery as bbq
931+
>>> animal = bpd.Series(["Tiger", "Rabbit", "Blue Whale"])
932+
>>> bbq.ai.score(("Rank the relative weights of ", animal, " on the scale from 1 to 3"))
933933
0 2.0
934934
1 1.0
935935
2 3.0
@@ -983,10 +983,10 @@ def similarity(
983983
984984
**Examples:**
985985
986-
>>> import bigframes.pandas as bpd # doctest: +SKIP
987-
>>> import bigframes.bigquery as bbq # doctest: +SKIP
988-
>>> df = bpd.DataFrame({'word': ['happy', 'sad']}) # doctest: +SKIP
989-
>>> bbq.ai.similarity(df['word'], 'glad', endpoint='text-embedding-005') # doctest: +SKIP
986+
>>> import bigframes.pandas as bpd
987+
>>> import bigframes.bigquery as bbq
988+
>>> df = bpd.DataFrame({'word': ['happy', 'sad']})
989+
>>> bbq.ai.similarity(df['word'], 'glad', endpoint='text-embedding-005')
990990
0 0.916601
991991
1 0.660579
992992
@@ -1062,19 +1062,19 @@ def forecast(
10621062
10631063
Forecast using a pandas DataFrame:
10641064
1065-
>>> import pandas as pd # doctest: +SKIP
1066-
>>> import bigframes.pandas as bpd # doctest: +SKIP
1067-
>>> df = pd.DataFrame({"value": [1, 2, 3], "time": pd.to_datetime(["2020-01-01", "2020-01-02", "2020-01-03"])}) # doctest: +SKIP
1068-
>>> bpd.options.display.progress_bar = None # doctest: +SKIP
1069-
>>> forecasted_pandas_df = df.bigquery.ai.forecast(data_col="value", timestamp_col="time", horizon=2) # doctest: +SKIP
1070-
>>> type(forecasted_pandas_df) # doctest: +SKIP
1065+
>>> import pandas as pd
1066+
>>> import bigframes.pandas as bpd
1067+
>>> df = pd.DataFrame({"value": [1, 2, 3], "time": pd.to_datetime(["2020-01-01", "2020-01-02", "2020-01-03"])})
1068+
>>> bpd.options.display.progress_bar = None
1069+
>>> forecasted_pandas_df = df.bigquery.ai.forecast(data_col="value", timestamp_col="time", horizon=2)
1070+
>>> type(forecasted_pandas_df)
10711071
<class 'pandas.core.frame.DataFrame'>
10721072
10731073
Forecast using a BigFrames DataFrame:
10741074
1075-
>>> bf_df = bpd.DataFrame({"value": [1, 2, 3], "time": pd.to_datetime(["2020-01-01", "2020-01-02", "2020-01-03"])}) # doctest: +SKIP
1076-
>>> forecasted_bf_df = bf_df.bigquery.ai.forecast(data_col="value", timestamp_col="time", horizon=2) # doctest: +SKIP
1077-
>>> type(forecasted_bf_df) # doctest: +SKIP
1075+
>>> bf_df = bpd.DataFrame({"value": [1, 2, 3], "time": pd.to_datetime(["2020-01-01", "2020-01-02", "2020-01-03"])})
1076+
>>> forecasted_bf_df = bf_df.bigquery.ai.forecast(data_col="value", timestamp_col="time", horizon=2)
1077+
>>> type(forecasted_bf_df)
10781078
<class 'bigframes.dataframe.DataFrame'>
10791079
10801080
Args:

0 commit comments

Comments
 (0)