Class: ContentEmbedding::ActivityEmbedding

Inherits:
ContentEmbedding
  • Object
show all
Includes:
TextSearchable
Defined in:
app/models/content_embedding/activity_embedding.rb

Overview

Partition model for Activity embeddings.
Maps to the content_embeddings_activities partition table.

Activity embeddings are sensitive (internal CRM notes) and excluded from MCP.

== Schema Information

Table name: content_embeddings_activities
Database name: primary

id :bigint not null, primary key
content_hash :string(32)
content_type :string default("primary"), not null
embeddable_type :string not null
embedding_dimensions :integer
embedding_model :string
locale :string default("en")
model :string
token_count :integer
unified_embedding :vector
created_at :timestamp not null
updated_at :timestamp not null
embeddable_id :bigint not null

Indexes

idx_ce_activities_embedding_model (embedding_model)
idx_ce_activities_unique (embeddable_id,content_type,locale) UNIQUE

Foreign Keys

fk_ce_activities_embeddable (embeddable_id => activities.id) ON DELETE => cascade

ContentEmbedding STI subclass for activity embeddings.

Examples:

Semantic search for activity notes

ContentEmbedding::ActivityEmbedding.semantic_search("customer mentioned budget concerns")

Constant Summary

Constants included from TextSearchable

TextSearchable::SIMILARITY_THRESHOLD

Belongs to collapse

Class Method Summary collapse

Methods included from TextSearchable

apply_locale_filter, apply_published_filter, generate_text_query_embedding, locale_filtered?, semantic_search

Class Method Details

.primary_contentActiveRecord::Relation<ContentEmbedding::ActivityEmbedding>

A relation of ContentEmbedding::ActivityEmbeddings that are primary content. Active Record Scope

Returns:

See Also:



51
# File 'app/models/content_embedding/activity_embedding.rb', line 51

scope :primary_content, -> { where(content_type: 'primary') }

Instance Method Details

#embeddableActivity Also known as: activity

Returns:

See Also:



46
# File 'app/models/content_embedding/activity_embedding.rb', line 46

belongs_to :embeddable, class_name: 'Activity'