pub struct LLMDriftProfile {
pub config: LLMDriftConfig,
pub metrics: Vec<LLMMetric>,
pub scouter_version: String,
pub workflow: Workflow,
pub metric_names: Vec<String>,
}
Fields§
§config: LLMDriftConfig
§metrics: Vec<LLMMetric>
§scouter_version: String
§workflow: Workflow
§metric_names: Vec<String>
Implementations§
Source§impl LLMDriftProfile
impl LLMDriftProfile
Sourcepub fn new(
config: LLMDriftConfig,
metrics: Vec<LLMMetric>,
workflow: Option<Bound<'_, PyAny>>,
) -> Result<LLMDriftProfile, ProfileError>
pub fn new( config: LLMDriftConfig, metrics: Vec<LLMMetric>, workflow: Option<Bound<'_, PyAny>>, ) -> Result<LLMDriftProfile, ProfileError>
Create a new LLMDriftProfile LLM evaluations are run asynchronously on the scouter server.
§Logic flow:
- If a user provides only a list of metrics, a workflow will be created from the metrics using
from_metrics
method. - If a user provides a workflow, It will be parsed and validated using
from_workflow
method.- The user must also provide a list of metrics that will be used to evaluate the output of the workflow.
- The metric names must correspond to the final task names in the workflow In addition, baseline metrics and threshold will be extracted from the LLMMetric.
§Arguments
config
- LLMDriftConfig - The configuration for the LLM drift profilemetrics
- Option<Bound<’_, PyList>> - Optional list of metrics that will be used to evaluate the LLMworkflow
- Option<Bound<’_, PyAny>> - Optional workflow to use for the LLM drift profile
§Returns
Result<Self, ProfileError>
- The LLMDriftProfile
§Errors
ProfileError::MissingWorkflowError
- If the workflow is
pub fn __str__(&self) -> String
pub fn model_dump_json(&self) -> String
pub fn model_dump(&self, py: Python<'_>) -> Result<Py<PyDict>, ProfileError>
pub fn save_to_json( &self, path: Option<PathBuf>, ) -> Result<PathBuf, ProfileError>
pub fn model_validate(data: &Bound<'_, PyDict>) -> LLMDriftProfile
pub fn model_validate_json(json_string: String) -> LLMDriftProfile
pub fn from_file(path: PathBuf) -> Result<LLMDriftProfile, ProfileError>
pub fn update_config_args( &mut self, space: Option<String>, name: Option<String>, version: Option<String>, alert_config: Option<LLMAlertConfig>, ) -> Result<(), TypeError>
Sourcepub fn create_profile_request(&self) -> Result<ProfileRequest, TypeError>
pub fn create_profile_request(&self) -> Result<ProfileRequest, TypeError>
Create a profile request from the profile
Source§impl LLMDriftProfile
impl LLMDriftProfile
Sourcepub fn from_metrics(
config: LLMDriftConfig,
metrics: Vec<LLMMetric>,
) -> Result<LLMDriftProfile, ProfileError>
pub fn from_metrics( config: LLMDriftConfig, metrics: Vec<LLMMetric>, ) -> Result<LLMDriftProfile, ProfileError>
Creates an LLMDriftProfile from a configuration and a list of metrics.
§Arguments
config
- LLMDriftConfig - The configuration for the LLMmetrics
- Vec- The metrics that will be used to evaluate the LLM scouter_version
- Option- The version of scouter that the profile is created with.
§Returns
Result<Self, ProfileError>
- The LLMDriftProfile
Sourcepub fn from_workflow(
config: LLMDriftConfig,
workflow: Workflow,
metrics: Vec<LLMMetric>,
) -> Result<LLMDriftProfile, ProfileError>
pub fn from_workflow( config: LLMDriftConfig, workflow: Workflow, metrics: Vec<LLMMetric>, ) -> Result<LLMDriftProfile, ProfileError>
Creates an LLMDriftProfile from a workflow and a list of metrics. This is useful when the workflow is already defined and you want to create a profile from it. This is also for more advanced use cases where the workflow may need to execute many dependent tasks. Because of this, there are a few requirements:
- All beginning tasks in the the workflow must have “input” and/or “output” parameters defined.
- All ending tasks in the workflow must have a response type of “Score”.
- The user must also supply a list of metrics that will be used to evaluate the output of the workflow.
- The metric names must correspond to the final task names in the workflow.
§Arguments
config
- LLMDriftConfig - The configuration for the LLMworkflow
- Workflow - The workflow that will be used to evaluate the Lmetrics
- Vec- The metrics that will be used to evaluate the LLM scouter_version
- Option- The version of scouter that the profile is created with.
§Returns
Result<Self, ProfileError>
- The LLMDriftProfile
pub fn get_metric_value(&self, metric_name: &str) -> Result<f64, ProfileError>
Trait Implementations§
Source§impl Clone for LLMDriftProfile
impl Clone for LLMDriftProfile
Source§fn clone(&self) -> LLMDriftProfile
fn clone(&self) -> LLMDriftProfile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for LLMDriftProfile
impl Debug for LLMDriftProfile
Source§impl<'de> Deserialize<'de> for LLMDriftProfile
impl<'de> Deserialize<'de> for LLMDriftProfile
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LLMDriftProfile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LLMDriftProfile, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<'py> IntoPyObject<'py> for LLMDriftProfile
impl<'py> IntoPyObject<'py> for LLMDriftProfile
Source§type Target = LLMDriftProfile
type Target = LLMDriftProfile
Source§type Output = Bound<'py, <LLMDriftProfile as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <LLMDriftProfile as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<LLMDriftProfile as IntoPyObject<'py>>::Output, <LLMDriftProfile as IntoPyObject<'py>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<LLMDriftProfile as IntoPyObject<'py>>::Output, <LLMDriftProfile as IntoPyObject<'py>>::Error>
Source§impl PartialEq for LLMDriftProfile
impl PartialEq for LLMDriftProfile
Source§impl ProfileBaseArgs for LLMDriftProfile
impl ProfileBaseArgs for LLMDriftProfile
fn get_base_args(&self) -> ProfileArgs
fn to_value(&self) -> Value
Source§impl PyClass for LLMDriftProfile
impl PyClass for LLMDriftProfile
Source§impl PyTypeInfo for LLMDriftProfile
impl PyTypeInfo for LLMDriftProfile
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Source§impl Serialize for LLMDriftProfile
impl Serialize for LLMDriftProfile
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl DerefToPyAny for LLMDriftProfile
impl StructuralPartialEq for LLMDriftProfile
Auto Trait Implementations§
impl Freeze for LLMDriftProfile
impl !RefUnwindSafe for LLMDriftProfile
impl Send for LLMDriftProfile
impl Sync for LLMDriftProfile
impl Unpin for LLMDriftProfile
impl !UnwindSafe for LLMDriftProfile
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromPyObject<'_> for T
impl<T> FromPyObject<'_> for T
Source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
Source§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.