@@ -1355,6 +1355,7 @@ def predict(
1355
1355
presence_penalty : Optional [float ] = None ,
1356
1356
frequency_penalty : Optional [float ] = None ,
1357
1357
logit_bias : Optional [Dict [int , float ]] = None ,
1358
+ seed : Optional [int ] = None ,
1358
1359
) -> "MultiCandidateTextGenerationResponse" :
1359
1360
"""Gets model response for a single prompt.
1360
1361
@@ -1387,6 +1388,12 @@ def predict(
1387
1388
Larger positive bias increases the probability of choosing the token.
1388
1389
Smaller negative bias decreases the probability of choosing the token.
1389
1390
Range: [-100.0, 100.0]
1391
+ seed:
1392
+ Decoder generates random noise with a pseudo random number generator, temperature * noise is added to
1393
+ logits before sampling. The pseudo random number generator (prng) takes a seed as input, it generates
1394
+ the same output with the same seed. If seed is not set, the seed used in decoder will not be
1395
+ deterministic, thus the generated random noise will not be deterministic. If seed is set, the
1396
+ generated random noise will be deterministic.
1390
1397
1391
1398
Returns:
1392
1399
A `MultiCandidateTextGenerationResponse` object that contains the text produced by the model.
@@ -1404,6 +1411,7 @@ def predict(
1404
1411
presence_penalty = presence_penalty ,
1405
1412
frequency_penalty = frequency_penalty ,
1406
1413
logit_bias = logit_bias ,
1414
+ seed = seed ,
1407
1415
)
1408
1416
1409
1417
prediction_response = self ._endpoint .predict (
@@ -1436,6 +1444,7 @@ async def predict_async(
1436
1444
presence_penalty : Optional [float ] = None ,
1437
1445
frequency_penalty : Optional [float ] = None ,
1438
1446
logit_bias : Optional [Dict [int , float ]] = None ,
1447
+ seed : Optional [int ] = None ,
1439
1448
) -> "MultiCandidateTextGenerationResponse" :
1440
1449
"""Asynchronously gets model response for a single prompt.
1441
1450
@@ -1468,6 +1477,12 @@ async def predict_async(
1468
1477
Larger positive bias increases the probability of choosing the token.
1469
1478
Smaller negative bias decreases the probability of choosing the token.
1470
1479
Range: [-100.0, 100.0]
1480
+ seed:
1481
+ Decoder generates random noise with a pseudo random number generator, temperature * noise is added to
1482
+ logits before sampling. The pseudo random number generator (prng) takes a seed as input, it generates
1483
+ the same output with the same seed. If seed is not set, the seed used in decoder will not be
1484
+ deterministic, thus the generated random noise will not be deterministic. If seed is set, the
1485
+ generated random noise will be deterministic.
1471
1486
1472
1487
Returns:
1473
1488
A `MultiCandidateTextGenerationResponse` object that contains the text produced by the model.
@@ -1485,6 +1500,7 @@ async def predict_async(
1485
1500
presence_penalty = presence_penalty ,
1486
1501
frequency_penalty = frequency_penalty ,
1487
1502
logit_bias = logit_bias ,
1503
+ seed = seed ,
1488
1504
)
1489
1505
1490
1506
prediction_response = await self ._endpoint .predict_async (
@@ -1509,6 +1525,7 @@ def predict_streaming(
1509
1525
presence_penalty : Optional [float ] = None ,
1510
1526
frequency_penalty : Optional [float ] = None ,
1511
1527
logit_bias : Optional [Dict [int , float ]] = None ,
1528
+ seed : Optional [int ] = None ,
1512
1529
) -> Iterator [TextGenerationResponse ]:
1513
1530
"""Gets a streaming model response for a single prompt.
1514
1531
@@ -1541,6 +1558,12 @@ def predict_streaming(
1541
1558
Larger positive bias increases the probability of choosing the token.
1542
1559
Smaller negative bias decreases the probability of choosing the token.
1543
1560
Range: [-100.0, 100.0]
1561
+ seed:
1562
+ Decoder generates random noise with a pseudo random number generator, temperature * noise is added to
1563
+ logits before sampling. The pseudo random number generator (prng) takes a seed as input, it generates
1564
+ the same output with the same seed. If seed is not set, the seed used in decoder will not be
1565
+ deterministic, thus the generated random noise will not be deterministic. If seed is set, the
1566
+ generated random noise will be deterministic.
1544
1567
1545
1568
Yields:
1546
1569
A stream of `TextGenerationResponse` objects that contain partial
@@ -1557,6 +1580,7 @@ def predict_streaming(
1557
1580
presence_penalty = presence_penalty ,
1558
1581
frequency_penalty = frequency_penalty ,
1559
1582
logit_bias = logit_bias ,
1583
+ seed = seed ,
1560
1584
)
1561
1585
1562
1586
prediction_service_client = self ._endpoint ._prediction_client
@@ -1587,6 +1611,7 @@ async def predict_streaming_async(
1587
1611
presence_penalty : Optional [float ] = None ,
1588
1612
frequency_penalty : Optional [float ] = None ,
1589
1613
logit_bias : Optional [Dict [int , float ]] = None ,
1614
+ seed : Optional [int ] = None ,
1590
1615
) -> AsyncIterator [TextGenerationResponse ]:
1591
1616
"""Asynchronously gets a streaming model response for a single prompt.
1592
1617
@@ -1619,6 +1644,12 @@ async def predict_streaming_async(
1619
1644
Larger positive bias increases the probability of choosing the token.
1620
1645
Smaller negative bias decreases the probability of choosing the token.
1621
1646
Range: [-100.0, 100.0]
1647
+ seed:
1648
+ Decoder generates random noise with a pseudo random number generator, temperature * noise is added to
1649
+ logits before sampling. The pseudo random number generator (prng) takes a seed as input, it generates
1650
+ the same output with the same seed. If seed is not set, the seed used in decoder will not be
1651
+ deterministic, thus the generated random noise will not be deterministic. If seed is set, the
1652
+ generated random noise will be deterministic.
1622
1653
1623
1654
Yields:
1624
1655
A stream of `TextGenerationResponse` objects that contain partial
@@ -1635,6 +1666,7 @@ async def predict_streaming_async(
1635
1666
presence_penalty = presence_penalty ,
1636
1667
frequency_penalty = frequency_penalty ,
1637
1668
logit_bias = logit_bias ,
1669
+ seed = seed ,
1638
1670
)
1639
1671
1640
1672
prediction_service_async_client = self ._endpoint ._prediction_async_client
@@ -1671,6 +1703,7 @@ def _create_text_generation_prediction_request(
1671
1703
presence_penalty : Optional [float ] = None ,
1672
1704
frequency_penalty : Optional [float ] = None ,
1673
1705
logit_bias : Optional [Dict [int , int ]] = None ,
1706
+ seed : Optional [int ] = None ,
1674
1707
) -> "_PredictionRequest" :
1675
1708
"""Prepares the text generation request for a single prompt.
1676
1709
@@ -1703,6 +1736,12 @@ def _create_text_generation_prediction_request(
1703
1736
Larger positive bias increases the probability of choosing the token.
1704
1737
Smaller negative bias decreases the probability of choosing the token.
1705
1738
Range: [-100.0, 100.0]
1739
+ seed:
1740
+ Decoder generates random noise with a pseudo random number generator, temperature * noise is added to
1741
+ logits before sampling. The pseudo random number generator (prng) takes a seed as input, it generates
1742
+ the same output with the same seed. If seed is not set, the seed used in decoder will not be
1743
+ deterministic, thus the generated random noise will not be deterministic. If seed is set, the
1744
+ generated random noise will be deterministic.
1706
1745
1707
1746
Returns:
1708
1747
A `_PredictionRequest` object that contains prediction instance and parameters.
@@ -1749,6 +1788,9 @@ def _create_text_generation_prediction_request(
1749
1788
if logit_bias is not None :
1750
1789
prediction_parameters ["logitBias" ] = logit_bias
1751
1790
1791
+ if seed is not None :
1792
+ prediction_parameters ["seed" ] = seed
1793
+
1752
1794
return _PredictionRequest (
1753
1795
instance = instance ,
1754
1796
parameters = prediction_parameters ,
0 commit comments