pub struct GraphsClient<'a> { /* private fields */ }Expand description
Graphs API client.
Use this for graph completions and verifier inference.
Implementations§
Source§impl<'a> GraphsClient<'a>
impl<'a> GraphsClient<'a>
Sourcepub async fn complete(
&self,
request: GraphCompletionRequest,
) -> Result<GraphCompletionResponse, CoreError>
pub async fn complete( &self, request: GraphCompletionRequest, ) -> Result<GraphCompletionResponse, CoreError>
Sourcepub async fn list_graphs(
&self,
kind: Option<&str>,
limit: Option<i32>,
) -> Result<Value, CoreError>
pub async fn list_graphs( &self, kind: Option<&str>, limit: Option<i32>, ) -> Result<Value, CoreError>
List graphs registered to the org.
Sourcepub async fn complete_raw(&self, request: Value) -> Result<Value, CoreError>
pub async fn complete_raw(&self, request: Value) -> Result<Value, CoreError>
Execute a raw graph completion from a JSON value.
Sourcepub async fn verify(
&self,
trace: Value,
rubric: Value,
options: Option<VerifierOptions>,
) -> Result<VerifierResponse, CoreError>
pub async fn verify( &self, trace: Value, rubric: Value, options: Option<VerifierOptions>, ) -> Result<VerifierResponse, CoreError>
Run verifier inference on a trace.
This evaluates a trace against a rubric using the verifier graph.
§Arguments
trace- The trace to verify (JSON object with events)rubric- The rubric to evaluate againstoptions- Optional verifier configuration
§Returns
The verification result with scores and reviews.
§Example
ⓘ
let result = client.graphs().verify(
json!({
"events": [
{"type": "user_message", "content": "Hello"},
{"type": "assistant_message", "content": "Hi there!"}
]
}),
json!({
"objectives": [
{"name": "helpfulness", "description": "Be helpful"}
]
}),
None,
).await?;
println!("Objectives: {:?}", result.objectives);Sourcepub async fn rlm_inference(
&self,
query: &str,
context: Value,
options: Option<RlmOptions>,
) -> Result<Value, CoreError>
pub async fn rlm_inference( &self, query: &str, context: Value, options: Option<RlmOptions>, ) -> Result<Value, CoreError>
Run RLM (Retrieval-augmented LM) inference.
This is useful for large context scenarios where the full trace doesn’t fit in a single context window.
§Arguments
query- The query/question to answercontext- The context to search throughoptions- Optional RLM configuration
§Returns
The RLM output as a JSON value.
Auto Trait Implementations§
impl<'a> Freeze for GraphsClient<'a>
impl<'a> !RefUnwindSafe for GraphsClient<'a>
impl<'a> Send for GraphsClient<'a>
impl<'a> Sync for GraphsClient<'a>
impl<'a> Unpin for GraphsClient<'a>
impl<'a> !UnwindSafe for GraphsClient<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request