galileo_protect package

Subpackages

Submodules

galileo_protect.invoke module

invoke(payload, prioritized_rulesets=None, project_id=None, stage_name=None, stage_id=None, timeout=10.0, metadata=None, headers=None, config=None)
Return type:

Response

async ainvoke(payload, prioritized_rulesets=None, project_id=None, stage_name=None, stage_id=None, timeout=10.0, metadata=None, headers=None, config=None)
Return type:

Response

galileo_protect.langchain module

class PayloadV1(**data)

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

input: Optional[str]
output: Optional[str]
class ProtectTool(**data)

Bases: BaseTool

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

description: str

Used to tell the model how/when/why to use the tool.

You can provide few-shot examples as a part of the description.

args_schema: Type[BaseModel]

Pydantic model class to validate and parse the tool’s input arguments.

prioritized_rulesets: Optional[Sequence[Ruleset]]
project_id: Optional[Annotated[UUID]]
stage_name: Optional[str]
stage_id: Optional[Annotated[UUID]]
timeout: float
config: Optional[ProtectConfig]
pydantic model ProtectParser

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field chain: Runnable [Required]

The chain to trigger if the Protect invocation is not triggered.

field echo_output: bool = False

Echo the output of the Protect invocation.

field ignore_trigger: bool = False

Ignore the status of the Protect invocation and always trigger the rest of the chain.

parser(response_raw_json)
Return type:

str

galileo_protect.project module

create_project(name='project', config=None)
Return type:

ProjectResponse

galileo_protect.stage module

create_stage(project_id=None, name=None, description=None, action=PassthroughAction(type=<ActionType.PASSTHROUGH: 'PASSTHROUGH'>), action_enabled=False, config=None)
Return type:

StageResponse

pause_stage(project_id=None, stage_id=None, config=None)

Pause a stage.

If the stage is already paused, the rulesets in the stage will not be evaluated.

Parameters:
  • project_id (Optional[UUID4], optional) – Project ID, by default None and will be taken from the config.

  • stage_id (Optional[UUID4], optional) – Stage ID, by default None and will be taken from the config.

  • config (Optional[ProtectConfig], optional) – Protect config, by default None and will be taken from the env vars or the local config file.

Return type:

None

Raises:
  • ValueError – If the project ID is not provided or found.

  • ValueError – If the stage ID is not provided or found.

resume_stage(project_id=None, stage_id=None, config=None)
Return type:

None

Module contents