Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.27.0"
".": "0.28.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 78
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-1c6045460c43f65b30ffcef9f707e8d71dca568bf8d208347a6046a6f03ff239.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-4ac5f2286270f1f2c2b41e7f57fcc0527f602ce8d9383c790ed40ce21236e0cf.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.28.0 (2025-03-21)

Full Changelog: [v0.27.0...v0.28.0](https://github.com/runloopai/api-client-python/compare/v0.27.0...v0.28.0)

### Features

* **api:** api update ([#575](https://github.com/runloopai/api-client-python/issues/575)) ([c6f1ca5](https://github.com/runloopai/api-client-python/commit/c6f1ca5d4101b6c1b62326a1bf4d7bd090461595))

## 0.27.0 (2025-03-21)

Full Changelog: [v0.26.0...v0.27.0](https://github.com/runloopai/api-client-python/compare/v0.26.0...v0.27.0)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "runloop_api_client"
version = "0.27.0"
version = "0.28.0"
description = "The official Python library for the runloop API"
dynamic = ["readme"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/runloop_api_client/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "runloop_api_client"
__version__ = "0.27.0" # x-release-please-version
__version__ = "0.28.0" # x-release-please-version
106 changes: 104 additions & 2 deletions src/runloop_api_client/types/scoring_function.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,118 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Union, Optional
from typing_extensions import Literal, Annotated, TypeAlias

from .._utils import PropertyInfo
from .._models import BaseModel

__all__ = ["ScoringFunction"]
__all__ = [
"ScoringFunction",
"Scorer",
"ScorerAstGrepScoringFunction",
"ScorerBashScriptScoringFunction",
"ScorerCommandScoringFunction",
"ScorerCustomScoringFunction",
"ScorerPythonScriptScoringFunction",
"ScorerTestBasedScoringFunction",
"ScorerTestBasedScoringFunctionTestFile",
]


class ScorerAstGrepScoringFunction(BaseModel):
pattern: str
"""AST pattern to match."""

search_directory: str
"""The path to search."""

type: Literal["ast_grep_scorer"]

lang: Optional[str] = None
"""The language of the pattern."""


class ScorerBashScriptScoringFunction(BaseModel):
type: Literal["bash_script_scorer"]

bash_script: Optional[str] = None
"""
A single bash script that sets up the environment, scores, and prints the final
score to standard out. Score should be a float between 0.0 and 1.0, and look
like "score=[0.0..1.0].
"""


class ScorerCommandScoringFunction(BaseModel):
type: Literal["command_scorer"]

command: Optional[str] = None
"""The command to execute."""


class ScorerCustomScoringFunction(BaseModel):
type: Literal["custom_scorer"]

scorer_params: Optional[object] = None
"""Additional JSON structured context to pass to the scoring function."""


class ScorerPythonScriptScoringFunction(BaseModel):
python_script: str
"""Python script to be run.

The script should output the score to standard out as a float between 0.0 and
1.0.
"""

type: Literal["python_script_scorer"]

requirements_contents: Optional[str] = None
"""Package dependencies to be installed.

The requirements should be a valid requirements.txt file.
"""


class ScorerTestBasedScoringFunctionTestFile(BaseModel):
file_contents: Optional[str] = None
"""Content of the test file"""

file_path: Optional[str] = None
"""
Path to write content of the test file, relative to your environment's working
directory
"""


class ScorerTestBasedScoringFunction(BaseModel):
type: Literal["test_based_scorer"]

test_command: Optional[str] = None
"""The command to execute for running the tests"""

test_files: Optional[List[ScorerTestBasedScoringFunctionTestFile]] = None
"""List of test files to create"""


Scorer: TypeAlias = Annotated[
Union[
ScorerAstGrepScoringFunction,
ScorerBashScriptScoringFunction,
ScorerCommandScoringFunction,
ScorerCustomScoringFunction,
ScorerPythonScriptScoringFunction,
ScorerTestBasedScoringFunction,
],
PropertyInfo(discriminator="type"),
]


class ScoringFunction(BaseModel):
name: str
"""Name of scoring function. Names must only contain [a-zA-Z0-9_-]."""

scoring_function: ScoringFunction
scorer: Scorer
"""The scoring function to use for evaluating this scenario.

The type field determines which built-in function to use.
Expand Down
48 changes: 24 additions & 24 deletions src/runloop_api_client/types/scoring_function_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@

__all__ = [
"ScoringFunctionParam",
"ScoringFunction",
"ScoringFunctionAstGrepScoringFunction",
"ScoringFunctionBashScriptScoringFunction",
"ScoringFunctionCommandScoringFunction",
"ScoringFunctionCustomScoringFunction",
"ScoringFunctionPythonScriptScoringFunction",
"ScoringFunctionTestBasedScoringFunction",
"ScoringFunctionTestBasedScoringFunctionTestFile",
"Scorer",
"ScorerAstGrepScoringFunction",
"ScorerBashScriptScoringFunction",
"ScorerCommandScoringFunction",
"ScorerCustomScoringFunction",
"ScorerPythonScriptScoringFunction",
"ScorerTestBasedScoringFunction",
"ScorerTestBasedScoringFunctionTestFile",
]


class ScoringFunctionAstGrepScoringFunction(TypedDict, total=False):
class ScorerAstGrepScoringFunction(TypedDict, total=False):
pattern: Required[str]
"""AST pattern to match."""

Expand All @@ -31,7 +31,7 @@ class ScoringFunctionAstGrepScoringFunction(TypedDict, total=False):
"""The language of the pattern."""


class ScoringFunctionBashScriptScoringFunction(TypedDict, total=False):
class ScorerBashScriptScoringFunction(TypedDict, total=False):
type: Required[Literal["bash_script_scorer"]]

bash_script: str
Expand All @@ -42,21 +42,21 @@ class ScoringFunctionBashScriptScoringFunction(TypedDict, total=False):
"""


class ScoringFunctionCommandScoringFunction(TypedDict, total=False):
class ScorerCommandScoringFunction(TypedDict, total=False):
type: Required[Literal["command_scorer"]]

command: str
"""The command to execute."""


class ScoringFunctionCustomScoringFunction(TypedDict, total=False):
class ScorerCustomScoringFunction(TypedDict, total=False):
type: Required[Literal["custom_scorer"]]

scorer_params: Optional[object]
"""Additional JSON structured context to pass to the scoring function."""


class ScoringFunctionPythonScriptScoringFunction(TypedDict, total=False):
class ScorerPythonScriptScoringFunction(TypedDict, total=False):
python_script: Required[str]
"""Python script to be run.

Expand All @@ -73,7 +73,7 @@ class ScoringFunctionPythonScriptScoringFunction(TypedDict, total=False):
"""


class ScoringFunctionTestBasedScoringFunctionTestFile(TypedDict, total=False):
class ScorerTestBasedScoringFunctionTestFile(TypedDict, total=False):
file_contents: str
"""Content of the test file"""

Expand All @@ -84,31 +84,31 @@ class ScoringFunctionTestBasedScoringFunctionTestFile(TypedDict, total=False):
"""


class ScoringFunctionTestBasedScoringFunction(TypedDict, total=False):
class ScorerTestBasedScoringFunction(TypedDict, total=False):
type: Required[Literal["test_based_scorer"]]

test_command: str
"""The command to execute for running the tests"""

test_files: Iterable[ScoringFunctionTestBasedScoringFunctionTestFile]
test_files: Iterable[ScorerTestBasedScoringFunctionTestFile]
"""List of test files to create"""


ScoringFunction: TypeAlias = Union[
ScoringFunctionAstGrepScoringFunction,
ScoringFunctionBashScriptScoringFunction,
ScoringFunctionCommandScoringFunction,
ScoringFunctionCustomScoringFunction,
ScoringFunctionPythonScriptScoringFunction,
ScoringFunctionTestBasedScoringFunction,
Scorer: TypeAlias = Union[
ScorerAstGrepScoringFunction,
ScorerBashScriptScoringFunction,
ScorerCommandScoringFunction,
ScorerCustomScoringFunction,
ScorerPythonScriptScoringFunction,
ScorerTestBasedScoringFunction,
]


class ScoringFunctionParam(TypedDict, total=False):
name: Required[str]
"""Name of scoring function. Names must only contain [a-zA-Z0-9_-]."""

scoring_function: Required[ScoringFunction]
scorer: Required[Scorer]
"""The scoring function to use for evaluating this scenario.

The type field determines which built-in function to use.
Expand Down
Loading
Loading