Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/lance-context-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ pub struct AddRecordRequest {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub session_id: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tenant: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub source: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub state_metadata: Option<StateMetadataDto>,
Expand Down Expand Up @@ -227,6 +231,10 @@ pub struct RecordPatchDto {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub session_id: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tenant: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub source: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub state_metadata: Option<StateMetadataDto>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub metadata: Option<Value>,
Expand All @@ -249,6 +257,8 @@ impl RecordPatchDto {
pub fn is_empty(&self) -> bool {
self.bot_id.is_none()
&& self.session_id.is_none()
&& self.tenant.is_none()
&& self.source.is_none()
&& self.state_metadata.is_none()
&& self.metadata.is_none()
&& self.relationships.is_none()
Expand Down Expand Up @@ -290,6 +300,10 @@ pub struct RecordDto {
pub bot_id: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub session_id: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tenant: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub source: Option<String>,
pub created_at: DateTime<Utc>,
pub role: String,
pub content_type: String,
Expand Down
6 changes: 6 additions & 0 deletions crates/lance-context-core/src/api_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ fn patch_from_dto(patch: &RecordPatchDto) -> RecordPatch {
RecordPatch {
bot_id: patch.bot_id.clone(),
session_id: patch.session_id.clone(),
tenant: patch.tenant.clone(),
source: patch.source.clone(),
state_metadata: patch.state_metadata.as_ref().map(|sm| StateMetadata {
step: sm.step,
active_plan_id: sm.active_plan_id.clone(),
Expand Down Expand Up @@ -340,6 +342,8 @@ fn record_from_add_request(r: &AddRecordRequest, id: String, run_id: String) ->
run_id,
bot_id: r.bot_id.clone(),
session_id: r.session_id.clone(),
tenant: r.tenant.clone(),
source: r.source.clone(),
created_at: Utc::now(),
role: r.role.clone(),
state_metadata: r.state_metadata.as_ref().map(|sm| StateMetadata {
Expand Down Expand Up @@ -376,6 +380,8 @@ fn record_to_dto(r: ContextRecord) -> RecordDto {
run_id: r.run_id,
bot_id: r.bot_id,
session_id: r.session_id,
tenant: r.tenant,
source: r.source,
created_at: r.created_at,
role: r.role,
content_type: r.content_type,
Expand Down
2 changes: 2 additions & 0 deletions crates/lance-context-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

mod api_impl;
mod context;
mod namespace;
mod record;
pub mod serde;
mod store;

pub use context::{Context, ContextEntry, Snapshot};
pub use namespace::{ContextNamespace, PartitionInfo, PartitionSelector, PartitionSpec};
pub use record::{
ContextRecord, LifecycleQueryOptions, MetadataFilter, RecordFilters, RecordPatch, Relationship,
RetrieveResult, SearchResult, StateMetadata, UpdateResult, UpsertResult, LIFECYCLE_ACTIVE,
Expand Down
Loading
Loading