Skip to documentation
Open Workflow Studio
On this page

Socrates and cached product search

Workflow reference | Synthetic Data | Vector DB | Azure deployments

Use Socrates to select a suitable model from an editable multimodal catalog. Use the Retail and Hospitality templates to search synthetic product descriptions and images with Cohere Embed and Rerank, reusable local caches, and optional OpenAI explanations.

Socrates

Choose Interactive UI > Socrates on an empty canvas, or find Socrates in the Properties template picker.

  1. Open Decisions: choose a model and configure the Foundry resource endpoint, deployment name, and SOCRATES_DECISIONS_API_KEY. The default deployment is Microsoft-Decision-1, using /providers/microsoft/v1/systemone.
  2. In Preview, enter a prompt and select one or more Cost-efficiency, Speed, and Output Quality profile cards. Choose an output family or let Decisions infer it from the task.
  3. Add optional image, audio, video, PDF, or text attachments. Uploads are limited to 4 MiB each and 16 attachments overall.
  4. Edit Model characteristics catalog to describe your available models and set each entry's available flag.
  5. Run and inspect the Socrates selection receipt.

The sample starts with a blank endpoint so you can configure your own Foundry resource. Properties stays editable, and Apply can save an incomplete draft. Before running, fill the endpoint and preview credential. In Preview credential, click the API-key field to open the saved Vault connections popup, then select a connection to fill its key. Selection can replace an existing preview key, keeps the request endpoint unchanged, and remains in session memory. Applying model settings preserves a key selected or entered in Preview.

The catalog covers chat, image, voice, video, document, and retrieval models. Entries contain id, model, playground, family, inputKinds, characteristics, and available. Capability and attachment compatibility narrow the submitted choices before preferences are applied. The example cost-efficiency, speed, and quality scores are labeled illustrative teaching values. Replace them with measured, task-specific guidance.

Only one billable Decisions request runs. Its typed state contains the prompt, context, selected profiles, eligible catalog, and attachment metadata. The model sees that metadata; the complete attachment sources stay in the final receipt. The receipt contains the selected catalog entry, decision model, optional probability distribution, selected-choice signal, and original task. It is a recommendation that can feed subsequent authored workflow steps. A routing signal requires review and does not establish output quality.

The prepared state is limited to 256,000 characters, questions to 64,000 characters, and the catalog to 32 entries. Invalid profiles, unsupported output families, incompatible catalogs, malformed responses, and unknown selections fail explicitly. The workflow has an editable catalog independent of the Model Router playground's deployment pool and routing API.

Industry templates

Category Template Purpose
Retail Retail product search Text or visual product discovery with local vector retrieval and query-aware reranking.
Retail Gift finder with grounded explanations Price-filtered gifts with one compact OpenAI explanation and exact product citations.
Retail Shop the look Style-brief and optional reference-image matching with grounded clothing and accessory explanations.
Hospitality Guest-room amenity sourcing A lighting and coffee-equipment shortlist for procurement review.

All four workflows share six original synthetic product photographs and descriptions: a navy backpack, sage trail shoes, a teal bottle, an amber lamp, a cream cardigan, and a copper kettle. Each bundled JPEG is 512 by 512 pixels. Files live in AspireDemo.Web\wwwroot\images\workflow-retail; the templates embed their bytes into portable seed inputs. Products, prices, images, and recommendations are fictional.

Configure Cohere Embed: query and the document Embed step inside Vector DB: cached product index with the same model and endpoint. The defaults use embed-v-4-0, 512 dimensions, four vector candidates, and three reranked results. The native Foundry endpoints are:

https://<resource>.services.ai.azure.com/providers/cohere/v2/embed
https://<resource>.services.ai.azure.com/providers/cohere/v2/rerank

Supply COHERE_EMBED_API_KEY and COHERE_RERANK_API_KEY. Keep Use incoming multimodal inputs, Use incoming dimensions, and Use incoming topN enabled. Both description text and image bytes enter the document Embed request as ordered text and image_url content parts. An optional query image enters the query Embed request beside the search text.

Explanation templates also require PRODUCT_CHAT_API_KEY. Their OpenAI Responses step uses gpt-5.4-mini, low reasoning, a 2,048-token output cap, strict JSON, disabled tools, and store: false. Only compact reranked product text reaches that model. Local citation checks compare returned product IDs and exact quoted description text.

Preview provides search text, a reference-image upload, dimension and result-count controls, and an optional maximum fictional product price. The complete JSON input remains editable below the form. An optional category field filters exact category values. Numeric price and category filters apply before the top-K shortlist. No matching products produces an explicit empty result and skips Rerank and explanation calls.

Cold and warm execution

flowchart LR
    Q[Query and optional image] --> QE[Cohere query Embed]
    S[Bundled synthetic products] --> C[Synthetic Data cache]
    C --> I[Vector DB cached index]
    I -->|Cache miss or changed inputs| DE[Cohere multimodal document Embed]
    DE --> V[Saved vectors and product metadata]
    I -->|Matching cache| V
    QE --> K[Filtered cosine top K]
    V --> K
    K --> R[Cohere Rerank on shortlist text]
    R --> P[Ranked product images and evidence]
    R --> O[Optional compact OpenAI explanation]
    O --> P
Run Provider calls
First run with bundled images One batched document Embed, one query Embed, and one Rerank.
Warm search One query Embed and one Rerank.
Explanation template One additional compact OpenAI call when products match.
Empty metadata-filter result Query Embed; document Embed runs only if the index is cold. Rerank and chat are skipped.
Explicit fresh-image rebuild One OpenAI Image call per product, followed by document Embed when image content changes.

Loading, editing, or packaging a template sends no model requests. Cache reuse removes repeated document embedding and image-generation costs. The cost pane reports available provider usage and pricing; missing usage remains unpriced. Actual cost and latency depend on the deployment, data, image settings, and result counts.

The result view retains product images, fictional prices, vector ranks, rerank ranks, relevance scores, original descriptions, and source IDs. Relevance and cosine scores describe the provider result and local retrieval. They require human review before purchasing or making a business decision.

Shared local caches

Both app modes use the browser-origin-scoped BenchiusWorkflowData IndexedDB database:

Table Built-in collection Saved content
syntheticData benchius-products-v1 The synthetic product catalog, including inline image bytes.
vectors benchius-product-embeddings-v1 Float vectors, dimensions, embedding-space identity, source fingerprint, and product metadata.

The same origin and collection names enable reuse across sample workflows. Saved workflow and playground auto-save preferences remain independent. Clearing site data removes these caches. They store plain synthetic data; keep credentials and confidential records in their designated protected stores.

Browser Web Locks serialize each read/generate/write sequence across tabs. A second cold run waits and reuses the committed collection. IndexedDB write failures preserve the prior transaction and report the storage problem. Browsers without IndexedDB or Web Locks fail explicitly.

Synthetic Data > Start from scratch defaults to false. An absent or empty collection runs its generator once. A populated collection is reused even when the input seed changes. Enable Start from scratch and apply the step to replace it after successful generation. Leave the setting enabled only while an intentional rebuild is needed.

Generate fresh OpenAI images on a cache miss also defaults to false. With the default, the generator copies the bundled images. To refresh an existing catalog, enable that Preview option and Synthetic Data's Start from scratch setting, then configure PRODUCT_IMAGE_API_KEY. Fresh images use the OpenAI Image playground, gpt-image-2, medium quality, 1024 by 1024 pixels, JPEG output, and one image per product. The sample contains six products and accepts at most 12. Disable Start from scratch afterward to restore reuse.

Vector DB > Index > Start from scratch defaults to false. The index fingerprint includes generator input, model endpoints, model identities, provider request settings, and run-variable values. Changed products, image bytes, dimensions, or embedding configuration regenerate the index. Matching inputs reuse it. Search and Upsert enforce the stored embedding space as well as dimensions, preventing a same-sized vector from another model or endpoint from being mixed into the collection. Rebuild explicitly after changing a deployment's underlying model without changing its request identity.

Index and synthetic rebuilds replace saved data after their generator succeeds. Empty generator results, provider failures, cancellation, malformed vectors, and storage failures produce explicit errors. Generator variables stay inside their generator; return needed values in the cached output. Recursive collection locks and cyclic nested cache dependencies are rejected.

Vector DB toolbox

The Vector DB category provides Cached vector index, Upsert vectors, Vector search, Read vector collection, Delete vector records, and Clear vector collection. See the step reference for schemas and examples.

Local search uses exact cosine similarity, finite nonzero vectors, stable ID ordering for tied scores, up to 1,000 records per collection, and up to 4,096 dimensions. Every collection must fit the 16 MiB cache and workflow text budgets. These bounded local collections provide an inspectable sample workflow; larger deployments can supply an IWorkflowDataStore implementation suited to their scale.

Exported and Azure-hosted workflows

Aspire dashboards, headless packages, and server automations use WorkflowFileDataStore through IWorkflowDataStore. Configure Workflow:DataDirectory or Workflow__DataDirectory to choose a writable directory. The default is a per-OS-user BenchiusWorkflowData directory under the system temporary directory. Collection writes use exclusive file leases and atomic replacement.

Packages retain bundled seed products in the source step. A compact caller input such as {"query":"Find warm desk lighting."} uses those products and default retrieval settings. The headless adapters retain their existing 64 KiB input limit; use small approved reference images when invoking that surface.

Browser IndexedDB contents are local to their origin and are independent of an exported host's cache. Container-local files are ephemeral. Persistent caches across Container Apps replacements or replicas require an explicitly configured storage mount or a shared store implementation. The deployment template leaves that storage integration to the operator. See the Azure storage documentation and Deploy to Azure architecture.

An unhandled error has occurred. Reload 🗙