Skip to content

API Reference parrot.advisors.catalog.catalog

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.advisors.catalog.catalog

View source

ProductCatalog - Abstraction over PgVectorStore for product management.

Provides:

  • Product CRUD with automatic embedding generation
  • Structured filtering + semantic search
  • Comparison utilities
  • Multi-tenant support via catalog_id

Alias FeatureType

Re-exported from parrot.advisors.models.FeatureType.

Alias PgVectorStore

Re-exported from parrot.stores.postgres.PgVectorStore.

Class ProductCatalog

Product catalog with hybrid search capabilities.

Combines:

  • Structured filtering (price, dimensions, category)
  • Semantic search (embeddings)
  • JSONB queries (specs, features)
Parameter Type Default Description
catalog_id str 'default' Identifier for multi-tenant isolation
table str 'products_catalog' PostgreSQL table name
schema str 'public' PostgreSQL schema
embedding_model str 'BAAI/bge-base-en-v1.5' HuggingFace model for embeddings
vector_store Optional[PgVectorStore] None Optional pre-configured PgVectorStore
use_query_prefix bool True Whether to use "query:" prefix for BGE models
**kwargs {}

Method ProductCatalog.initialize

Initialize the catalog store and create table if needed.

initialize(create_table: bool = True) -> None

Parameter Type Default Description
create_table bool True Whether to create the table schema

Method ProductCatalog.add_product

Add a product to the catalog.

add_product(product: ProductSpec, generate_embedding: bool = True) -> str

Parameter Type Default Description
product ProductSpec ProductSpec instance
generate_embedding bool True Whether to generate embedding from content

Returns: str — Product ID

Method ProductCatalog.get_product

Get a single product by ID.

get_product(product_id: str) -> Optional[ProductSpec]

Parameter Type Default Description
product_id str

Returns: Optional[ProductSpec]

Method ProductCatalog.get_products

Get multiple products by IDs.

get_products(product_ids: List[str]) -> List[ProductSpec]

Parameter Type Default Description
product_ids List[str]

Returns: List[ProductSpec]

Method ProductCatalog.get_all_products

Get all products in catalog.

get_all_products(category: Optional[str] = None, active_only: bool = True) -> List[ProductSpec]

Parameter Type Default Description
category Optional[str] None
active_only bool True

Returns: List[ProductSpec]

Method ProductCatalog.get_all_product_ids

Get all product IDs (lightweight query).

get_all_product_ids(category: Optional[str] = None) -> List[str]

Parameter Type Default Description
category Optional[str] None

Returns: List[str]

Method ProductCatalog.search

Search products with hybrid capabilities.

search(query: Optional[str] = None, filters: Optional[Dict[str, Any]] = None, limit: int = 10, score_threshold: float = 0.3, search_type: str = 'hybrid') -> List[ProductSearchResult]

Parameter Type Default Description
query Optional[str] None Natural language search query
filters Optional[Dict[str, Any]] None Structured filters (max_price, max_footprint, category, use_case, etc.)
limit int 10 Maximum results
score_threshold float 0.3 Minimum similarity score
search_type str 'hybrid' "semantic" (embedding only), "filter" (SQL only), "hybrid" (both)

Returns: List[ProductSearchResult] — List of ProductSearchResult

Method ProductCatalog.filter_products

Filter products by criteria, return matching IDs and elimination reasons.

Used by the selection wizard to narrow down candidates.

filter_products(product_ids: List[str], criteria: Dict[str, Any], soft_match: bool = True) -> Tuple[List[str], Dict[str, str]]

Parameter Type Default Description
product_ids List[str] Current candidate product IDs
criteria Dict[str, Any] Filter criteria to apply
soft_match bool True If True, products with empty use_cases are treated as "general purpose" and match any use_case criteria

Returns: Tuple[List[str], Dict[str, str]] — Tuple of (matching_ids, eliminated_dict) where eliminated_dict = {product_id: "reason"}

Method ProductCatalog.compare_products

Generate a comparison matrix for products.

compare_products(product_ids: List[str], comparison_aspects: Optional[List[str]] = None) -> Dict[str, Any]

Parameter Type Default Description
product_ids List[str] Products to compare
comparison_aspects Optional[List[str]] None Specific aspects to compare (default: all common features)

Returns: Dict[str, Any] — Comparison dict with products and feature matrix

Method ProductCatalog.close

Close database connections.

close() -> None

Alias ProductDimensions

Re-exported from parrot.advisors.models.ProductDimensions.

Alias ProductFeature

Re-exported from parrot.advisors.models.ProductFeature.

Class ProductSearchResult

Enhanced search result with product-specific fields.

Parameter Type Default Description
product ProductSpec
score float
match_reason str ''

Fields:

Field Type Default Description
product ProductSpec
score float
match_reason str ''

Alias ProductSpec

Re-exported from parrot.advisors.models.ProductSpec.

Alias SearchResult

Re-exported from parrot.models.stores.SearchResult.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally