Contains configurations need to run inferences.
| 56 | |
| 57 | |
| 58 | class InferenceConfig(BaseModel): |
| 59 | """Contains configurations need to run inferences.""" |
| 60 | |
| 61 | model_config = ConfigDict( |
| 62 | alias_generator=alias_generators.to_camel, |
| 63 | populate_by_name=True, |
| 64 | ) |
| 65 | |
| 66 | labels: Optional[dict[str, str]] = Field( |
| 67 | default=None, |
| 68 | description="""Labels with user-defined metadata to break down billed |
| 69 | charges.""", |
| 70 | ) |
| 71 | |
| 72 | parallelism: int = Field( |
| 73 | default=4, |
| 74 | description="""Number of parallel inferences to run during an Eval. Few |
| 75 | factors to consider while changing this value: |
| 76 | |
| 77 | 1) Your available quota with the model. Models tend to enforce per-minute or |
| 78 | per-second SLAs. Using a larger value could result in the eval quickly consuming |
| 79 | the quota. |
| 80 | |
| 81 | 2) The tools used by the Agent could also have their SLA. Using a larger value |
| 82 | could also overwhelm those tools.""", |
| 83 | ) |
| 84 | |
| 85 | use_live: bool = Field( |
| 86 | default=False, |
| 87 | description="""Whether to use live (bidirectional streaming) mode for |
| 88 | inference. This is required for Live API models (e.g., gemini-*-live-*).""", |
| 89 | ) |
| 90 | |
| 91 | live_timeout_seconds: int = Field( |
| 92 | default=DEFAULT_LIVE_TIMEOUT_SECONDS, |
| 93 | description="""Timeout in seconds for waiting for model turn completion in |
| 94 | live mode.""", |
| 95 | ) |
| 96 | |
| 97 | |
| 98 | class InferenceRequest(BaseModel): |
no outgoing calls