langgraph-api 0.1.1

Rust Client API of LangGraph
Documentation
/*
 * LangSmith Deployment
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.1.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Run {
    /// The ID of the run.
    #[serde(rename = "run_id")]
    pub run_id: uuid::Uuid,
    /// The ID of the thread.
    #[serde(rename = "thread_id")]
    pub thread_id: uuid::Uuid,
    /// The assistant that was used for this run.
    #[serde(rename = "assistant_id")]
    pub assistant_id: uuid::Uuid,
    /// The time the run was created.
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// The last time the run was updated.
    #[serde(rename = "updated_at")]
    pub updated_at: String,
    /// The status of the run. One of 'pending', 'running', 'error', 'success', 'timeout', 'interrupted'.
    #[serde(rename = "status")]
    pub status: Status,
    /// The run metadata.
    #[serde(rename = "metadata")]
    pub metadata: serde_json::Value,
    #[serde(rename = "kwargs")]
    pub kwargs: serde_json::Value,
    /// Strategy to handle concurrent runs on the same thread.
    #[serde(rename = "multitask_strategy")]
    pub multitask_strategy: MultitaskStrategy,
}

impl Run {
    pub fn new(
        run_id: uuid::Uuid,
        thread_id: uuid::Uuid,
        assistant_id: uuid::Uuid,
        created_at: String,
        updated_at: String,
        status: Status,
        metadata: serde_json::Value,
        kwargs: serde_json::Value,
        multitask_strategy: MultitaskStrategy,
    ) -> Run {
        Run {
            run_id,
            thread_id,
            assistant_id,
            created_at,
            updated_at,
            status,
            metadata,
            kwargs,
            multitask_strategy,
        }
    }
}
/// The status of the run. One of 'pending', 'running', 'error', 'success', 'timeout', 'interrupted'.
#[derive(
    Clone, Copy, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
)]
pub enum Status {
    #[serde(rename = "pending")]
    #[default]
    Pending,
    #[serde(rename = "running")]
    Running,
    #[serde(rename = "error")]
    Error,
    #[serde(rename = "success")]
    Success,
    #[serde(rename = "timeout")]
    Timeout,
    #[serde(rename = "interrupted")]
    Interrupted,
}
/// Strategy to handle concurrent runs on the same thread.
#[derive(
    Clone, Copy, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
)]
pub enum MultitaskStrategy {
    #[serde(rename = "reject")]
    #[default]
    Reject,
    #[serde(rename = "rollback")]
    Rollback,
    #[serde(rename = "interrupt")]
    Interrupt,
    #[serde(rename = "enqueue")]
    Enqueue,
}