recommendations

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Recommendations

推荐

Personalized recommendations through the TasteRay API.
通过 TasteRay API 实现个性化推荐。

Goal

目标

When making recommendations or reviewing recommendation-related code—whether API integrations, context building, or presentation logic—your goal is to achieve a 10/10 score.
Score all work on a 0-10 scale based on adherence to the principles and techniques in this skill. Provide your assessment as X/10 with specific feedback on what's working and what needs improvement to reach 10/10.
A 10/10 means the work:
  • Embodies the core principle (understanding precedes recommendation)
  • Builds rich context before calling the API
  • Presents recommendations with personalized explanations
  • Handles edge cases gracefully (low confidence, rate limits, errors)
  • Avoids all anti-patterns
Iterate until you reach 10/10.

在进行推荐或审核推荐相关代码(无论是 API 集成、上下文构建还是展示逻辑)时,你的目标是达到 10/10 的评分
根据本技能中的原则和技术,将所有工作按 0-10 分进行评分。以 X/10 的格式给出评估,并提供具体反馈,说明哪些部分做得好,以及需要改进哪些地方才能达到 10/10。
10/10 的标准意味着工作:
  • 体现核心原则(先理解,再推荐)
  • 在调用 API 前构建丰富的上下文
  • 结合个性化解释呈现推荐结果
  • 优雅处理边缘情况(低置信度、速率限制、错误)
  • 避免所有反模式
持续迭代直至达到 10/10。

Core Principle

核心原则

Understanding precedes recommendation.
Great recommendations come from deep understanding of the person—their preferences, constraints, history, and context. Never call the API without first building meaningful context from the conversation.
Key insight: A recommendation is only as good as the context that informed it.

先理解,再推荐。
优质的推荐源于对用户的深度理解——包括他们的偏好、限制条件、历史行为和上下文。绝不要在未从对话中构建有意义的上下文之前就调用 API。
关键见解:推荐的质量完全取决于支撑它的上下文质量。

API Overview

API 概述

The TasteRay Recommendation API provides personalized recommendations across multiple verticals.
TasteRay 推荐 API 可在多个领域提供个性化推荐。

Base URL

基础 URL

https://api.tasteray.com
https://api.tasteray.com

Authentication

身份验证

All requests require an API key in the header:
X-API-Key: your-api-key
所有请求都需要在请求头中携带 API 密钥:
X-API-Key: your-api-key

Core Endpoints

核心端点

EndpointMethodDescription
/v1/recommend
POSTGet personalized recommendations
/v1/explain
POSTGet detailed explanation for a single item
/v1/usage
GETCheck quota and usage statistics
See: API Reference

端点方法描述
/v1/recommend
POST获取个性化推荐
/v1/explain
POST获取单个物品的详细解释
/v1/usage
GET查看配额和使用统计数据
查看:API 参考

The Recommendation Flow

推荐流程

Every recommendation follows this pattern:
1. Build context from conversation
2. Call POST /v1/recommend
3. Interpret confidence scores
4. Present with personalized explanations
5. Iterate based on feedback
每个推荐都遵循以下模式:
1. 从对话中构建上下文
2. 调用 POST /v1/recommend
3. 解读置信度评分
4. 结合个性化解释呈现结果
5. 根据反馈迭代优化

Step 1: Build Context

步骤 1:构建上下文

Extract from the conversation:
  • preferences: Explicit likes/dislikes and taste patterns
  • profile: Psychological profile text (from elicitation skill)
  • constraints: Hard requirements (budget, dietary, location, etc.)
  • history: Past items they've liked or disliked
从对话中提取以下信息:
  • 偏好:明确的喜好/厌恶和口味模式
  • 档案:心理档案文本(来自引导技能)
  • 限制条件:硬性要求(预算、饮食、地点等)
  • 历史行为:用户过去喜欢或厌恶的物品

Step 2: Call the API

步骤 2:调用 API

json
POST /v1/recommend
{
  "vertical": "movies",
  "context": {
    "preferences": ["dark comedies", "complex characters"],
    "profile": "Values authenticity and depth. Drawn to stories about outsiders...",
    "constraints": {"max_length_minutes": 120},
    "history": [
      {"item": "Parasite", "rating": 5},
      {"item": "The Lobster", "rating": 4}
    ]
  },
  "count": 5
}
json
POST /v1/recommend
{
  "vertical": "movies",
  "context": {
    "preferences": ["dark comedies", "complex characters"],
    "profile": "Values authenticity and depth. Drawn to stories about outsiders...",
    "constraints": {"max_length_minutes": 120},
    "history": [
      {"item": "Parasite", "rating": 5},
      {"item": "The Lobster", "rating": 4}
    ]
  },
  "count": 5
}

Step 3: Interpret Confidence

步骤 3:解读置信度

ScoreMeaningAction
0.9+Strong matchLead with this recommendation
0.7-0.9Good matchPresent with confidence
0.5-0.7Moderate matchInclude caveats, explain why it might not fit
<0.5Weak matchOmit or explain significant uncertainty
评分含义操作
0.9+高度匹配将此推荐放在首位
0.7-0.9良好匹配自信地呈现
0.5-0.7中等匹配附带说明,解释可能不匹配的原因
<0.5弱匹配省略或明确说明存在较大不确定性

Step 4: Present Recommendations

步骤 4:呈现推荐结果

Don't just list items. Personalize the explanation:
Bad:
"Based on your preferences, I recommend Parasite."
Good:
"Given your appreciation for dark comedies with complex characters, Parasite would be a strong match. It has that same outsider perspective you responded to in The Lobster, but with sharper social commentary."
不要只罗列物品。要个性化解释:
不佳示例:
"根据你的偏好,我推荐《寄生虫》。"
优秀示例:
"考虑到你对带有复杂角色的黑色喜剧的喜爱,《寄生虫》会是非常合适的选择。它具备你在《龙虾》中欣赏的局外人视角,但带有更尖锐的社会评论。"

Step 5: Iterate

步骤 5:迭代优化

Use feedback to refine:
  • "That's not quite right" → Ask what's missing
  • "Tell me more about X" → Call
    /v1/explain
  • "Something different" → Adjust constraints and re-query

利用反馈进行优化:
  • "不太对我的胃口" → 询问缺少什么元素
  • "告诉我更多关于 X 的信息" → 调用
    /v1/explain
    端点
  • "换些不一样的" → 调整限制条件后重新查询

Context Building

上下文构建

The quality of recommendations depends entirely on context quality.
推荐的质量完全取决于上下文的质量。

Preferences Array

偏好数组

Explicit taste statements extracted from conversation:
json
"preferences": [
  "dark comedies",
  "complex anti-heroes",
  "slow-burn narratives",
  "dislikes: jump scares",
  "dislikes: predictable endings"
]
Extraction patterns:
  • "I love X" → positive preference
  • "I can't stand X" → negative preference (prefix with "dislikes:")
  • "Something like X" → reference point
  • "Not too X" → constraint or negative preference
从对话中提取的明确口味表述:
json
"preferences": [
  "dark comedies",
  "complex anti-heroes",
  "slow-burn narratives",
  "dislikes: jump scares",
  "dislikes: predictable endings"
]
提取模式:
  • "我喜欢 X" → 正向偏好
  • "我受不了 X" → 负向偏好(前缀为"dislikes:")
  • "类似 X 的东西" → 参考基准
  • "不要太 X" → 限制条件或负向偏好

Profile Text

档案文本

Free-form psychological profile. If using the elicitation skill, summarize findings:
json
"profile": "Values authenticity over polish. Drawn to outsider narratives
and stories about people who don't fit in. Appreciates moral ambiguity
and complex characters who aren't clearly good or bad. Responds strongly
to themes of class and social hierarchy. Prefers films that trust the
audience's intelligence."
自由格式的心理档案。如果使用引导技能,请总结发现:
json
"profile": "Values authenticity over polish. Drawn to outsider narratives
and stories about people who don't fit in. Appreciates moral ambiguity
and complex characters who aren't clearly good or bad. Responds strongly
to themes of class and social hierarchy. Prefers films that trust the
audience's intelligence."

Constraints Object

限制条件对象

Hard requirements that filter recommendations:
VerticalCommon Constraints
Movies
max_length_minutes
,
release_year_min
,
exclude_genres
Restaurants
cuisine
,
price_range
,
location
,
dietary
Products
max_price
,
category
,
brand_exclude
Travel
budget
,
dates
,
accessibility
,
interests
Jobs
location
,
salary_min
,
remote
,
experience_level
用于过滤推荐的硬性要求:
领域常见限制条件
电影
max_length_minutes
,
release_year_min
,
exclude_genres
餐厅
cuisine
,
price_range
,
location
,
dietary
商品
max_price
,
category
,
brand_exclude
旅行
budget
,
dates
,
accessibility
,
interests
工作
location
,
salary_min
,
remote
,
experience_level

History Array

历史行为数组

Past items with ratings (1-5 scale):
json
"history": [
  {"item": "The Grand Budapest Hotel", "rating": 5},
  {"item": "Transformers", "rating": 1},
  {"item": "Moonlight", "rating": 4}
]
Guidelines:
  • Include both positive and negative examples
  • Maximum 50 items (API limit)
  • More recent items are weighted higher
  • Include item identifiers when available (IMDB ID, etc.)
See: Context Patterns Reference

带有评分(1-5 分制)的过往物品:
json
"history": [
  {"item": "The Grand Budapest Hotel", "rating": 5},
  {"item": "Transformers", "rating": 1},
  {"item": "Moonlight", "rating": 4}
]
指南:
  • 同时包含正向和负向示例
  • 最多 50 个物品(API 限制)
  • 近期物品权重更高
  • 如有可用的物品标识符(如 IMDB ID),请一并包含
查看:上下文模式参考

Vertical-Specific Patterns

各领域特定模式

Movies & TV

电影与电视

Key context signals:
  • Genre preferences (and anti-preferences)
  • Pacing preferences (slow burn vs. action-packed)
  • Era preferences (classic, modern, contemporary)
  • Language/subtitle comfort
  • Mood they're seeking
Constraint examples:
json
{
  "max_length_minutes": 120,
  "release_year_min": 2010,
  "exclude_genres": ["horror", "musical"],
  "languages": ["en", "fr"],
  "streaming_services": ["netflix", "hulu"]
}
关键上下文信号:
  • 类型偏好(及排斥类型)
  • 节奏偏好(慢热 vs 动作密集)
  • 年代偏好(经典、现代、当代)
  • 语言/字幕接受度
  • 想要的情绪氛围
限制条件示例:
json
{
  "max_length_minutes": 120,
  "release_year_min": 2010,
  "exclude_genres": ["horror", "musical"],
  "languages": ["en", "fr"],
  "streaming_services": ["netflix", "hulu"]
}

Restaurants

餐厅

Key context signals:
  • Cuisine preferences and adventurousness
  • Price sensitivity
  • Dietary restrictions (must capture accurately)
  • Occasion context (date night, business, casual)
  • Ambiance preferences
Constraint examples:
json
{
  "location": {"lat": 37.7749, "lng": -122.4194, "radius_miles": 5},
  "price_range": [2, 3],
  "dietary": ["vegetarian-options"],
  "open_now": true
}
关键上下文信号:
  • 菜系偏好和冒险意愿
  • 价格敏感度
  • 饮食限制(必须准确捕捉)
  • 场合上下文(约会、商务、休闲)
  • 环境偏好
限制条件示例:
json
{
  "location": {"lat": 37.7749, "lng": -122.4194, "radius_miles": 5},
  "price_range": [2, 3],
  "dietary": ["vegetarian-options"],
  "open_now": true
}

Products

商品

Key context signals:
  • Use case and context
  • Quality vs. price tradeoff
  • Brand affinities and aversions
  • Feature priorities
  • Aesthetic preferences
Constraint examples:
json
{
  "max_price": 500,
  "category": "headphones",
  "brand_exclude": ["beats"],
  "features_required": ["noise-cancelling", "wireless"]
}
关键上下文信号:
  • 使用场景和上下文
  • 质量与价格的权衡
  • 品牌偏好与厌恶
  • 功能优先级
  • 审美偏好
限制条件示例:
json
{
  "max_price": 500,
  "category": "headphones",
  "brand_exclude": ["beats"],
  "features_required": ["noise-cancelling", "wireless"]
}

Travel

旅行

Key context signals:
  • Travel style (adventure, relaxation, cultural)
  • Comfort level with unfamiliarity
  • Activity preferences
  • Social context (solo, couple, family)
  • Previous destinations (loved and disliked)
Constraint examples:
json
{
  "budget_per_day": 200,
  "dates": {"start": "2024-06-01", "end": "2024-06-14"},
  "accessibility": ["wheelchair-accessible"],
  "climate": "warm",
  "visa_free_for": "US"
}
关键上下文信号:
  • 旅行风格(冒险、放松、文化体验)
  • 对陌生环境的适应程度
  • 活动偏好
  • 社交场景(独自、情侣、家庭)
  • 过往目的地(喜欢和厌恶的)
限制条件示例:
json
{
  "budget_per_day": 200,
  "dates": {"start": "2024-06-01", "end": "2024-06-14"},
  "accessibility": ["wheelchair-accessible"],
  "climate": "warm",
  "visa_free_for": "US"
}

Jobs

工作

Key context signals:
  • Career values and priorities
  • Work style preferences
  • Growth vs. stability orientation
  • Culture fit signals
  • Skills and experience level
Constraint examples:
json
{
  "location": "San Francisco",
  "remote": "hybrid",
  "salary_min": 150000,
  "experience_level": "senior",
  "company_size": ["startup", "mid"]
}

关键上下文信号:
  • 职业价值观和优先级
  • 工作风格偏好
  • 成长与稳定的倾向
  • 文化契合度信号
  • 技能和经验水平
限制条件示例:
json
{
  "location": "San Francisco",
  "remote": "hybrid",
  "salary_min": 150000,
  "experience_level": "senior",
  "company_size": ["startup", "mid"]
}

Presentation Patterns

呈现模式

How you present recommendations matters as much as what you recommend.
推荐的呈现方式和推荐内容本身同样重要。

Confidence-Based Presentation

基于置信度的呈现

High confidence (0.9+):
"This is a strong match for you. [Item] aligns well with your preference for [specific trait]."
Good confidence (0.7-0.9):
"[Item] should work well. It has [positive trait], though it's [caveat] which might not be exactly what you're looking for."
Moderate confidence (0.5-0.7):
"This one's a bit of a stretch, but [Item] might surprise you. It's [trait], which you haven't explicitly mentioned, but based on [pattern] you might appreciate it."
Low confidence (<0.5):
Generally omit, or: "If you're feeling adventurous, [Item] is quite different from your usual preferences, but [reason for including]."
高置信度(0.9+):
"这非常符合你的喜好。[物品] 与你对[特定特质]的偏好高度契合。"
良好置信度(0.7-0.9):
"[物品] 应该很适合你。它具备[正向特质],不过它也有[注意事项],可能不完全符合你的预期。"
中等置信度(0.5-0.7):
"这个推荐有点冒险,但[物品]可能会给你惊喜。它具备[特质],你没有明确提到过,但基于[模式]你可能会喜欢。"
低置信度(<0.5):
通常省略,或:"如果你想尝试新事物,[物品]与你通常的偏好差异很大,但[包含它的原因]。"

Explanation Structure

解释结构

For each recommendation, explain:
  1. The match - Why this fits their stated preferences
  2. The connection - How it relates to items they've liked
  3. The caveat - Any potential misalignment (if applicable)
对于每个推荐,需解释:
  1. 匹配点 - 为什么它符合用户明确表达的偏好
  2. 关联点 - 它与用户喜欢过的物品有何关联
  3. 注意事项 - 任何潜在的不匹配(如适用)

Handling Feedback

处理反馈

"Tell me more" → Use
/v1/explain
endpoint:
json
POST /v1/explain
{
  "vertical": "movies",
  "item": "Parasite",
  "context": { /* same context */ }
}
"Not quite right" → Ask clarifying questions:
"What about that recommendation missed the mark? Too [X]? Not enough [Y]?"
"Something completely different" → Adjust approach:
"Let me try a different angle. If we set aside [previous focus], what are you actually in the mood for?"
See: Presentation Patterns Reference

"告诉我更多" → 使用
/v1/explain
端点:
json
POST /v1/explain
{
  "vertical": "movies",
  "item": "Parasite",
  "context": { /* 相同上下文 */ }
}
"不太对我的胃口" → 提出澄清问题:
"这个推荐哪里不符合你的预期?太[X]?还是缺少[Y]?"
"完全不一样的东西" → 调整策略:
"让我换个角度试试。如果抛开[之前的关注点],你真正想要的是什么?"
查看:呈现模式参考

Integration with Elicitation

与引导技能的集成

The elicitation skill builds psychological profiles. Use these for richer recommendations.
引导技能用于构建心理档案。将其用于更丰富的推荐。

From Elicitation to Profile

从引导到档案

Self-defining memories reveal:
  • Formative experiences that shape taste
  • Emotional patterns that resonate in content
  • Identity themes (agency, communion, redemption)
Values elicitation reveals:
  • Core priorities that should be reflected in recommendations
  • What makes something feel "right"
Schema detection reveals:
  • Patterns that might influence reception
  • Topics or themes to handle carefully
自我定义记忆揭示:
  • 塑造口味的 formative 经历
  • 在内容中产生共鸣的情感模式
  • 身份主题(自主性、归属感、救赎)
价值观引导揭示:
  • 应在推荐中体现的核心优先级
  • 什么会让用户觉得“合适”
模式检测揭示:
  • 可能影响接受度的模式
  • 需要谨慎处理的主题或议题

Profile Construction

档案构建

After elicitation, construct a profile string:
json
"profile": "Core value: authenticity. Drawn to narratives about
self-reinvention (redemption themes in life story). Responds to
understated emotion over melodrama. Achievement-oriented but values
creative expression over status markers. Formative memory involves
finding belonging through shared creative work—look for collaborative
or community themes."
引导完成后,构建档案字符串:
json
"profile": "Core value: authenticity. Drawn to narratives about
self-reinvention (redemption themes in life story). Responds to
understated emotion over melodrama. Achievement-oriented but values
creative expression over status markers. Formative memory involves
finding belonging through shared creative work—look for collaborative
or community themes."

Example Integration

集成示例

  1. Use elicitation skill to understand the person
  2. Summarize findings in profile text
  3. Call recommendation API with rich context
  4. Present recommendations that connect to their story

  1. 使用引导技能了解用户
  2. 将发现总结为档案文本
  3. 调用推荐 API 并传入丰富上下文
  4. 呈现与用户经历相关的推荐

Error Handling

错误处理

Rate Limits

速率限制

The API returns
429 Too Many Requests
when limits are exceeded.
TierRequests/minRequests/day
Free10100
Pro605,000
Enterprise300Unlimited
Handling:
  • Check
    Retry-After
    header for wait time
  • Queue requests if hitting limits
  • Consider caching frequent queries
当超出限制时,API 返回
429 Too Many Requests
套餐每分钟请求数每日请求数
免费版10100
专业版605,000
企业版300无限
处理方式:
  • 查看
    Retry-After
    头获取等待时间
  • 如果达到限制,将请求加入队列
  • 考虑对频繁查询进行缓存

Authentication Errors

身份验证错误

401 Unauthorized
- Invalid or missing API key.
Handling:
  • Verify API key is set correctly
  • Check key hasn't expired
  • Ensure key has appropriate permissions
401 Unauthorized
- API 密钥无效或缺失。
处理方式:
  • 验证 API 密钥是否设置正确
  • 检查密钥是否已过期
  • 确保密钥拥有适当的权限

Server Errors

服务器错误

500+
- Server-side issues.
Handling:
  • Implement exponential backoff
  • Have fallback behavior (graceful degradation)
  • Log for debugging
See: API Reference for complete error codes.

500+
- 服务器端问题。
处理方式:
  • 实现指数退避机制
  • 准备回退行为(优雅降级)
  • 记录日志用于调试
查看:API 参考 获取完整错误代码。

Anti-Patterns

参考资料

What NOT to do:
详细指南:
  • API 参考 - 完整的端点文档、参数、响应
  • 上下文模式 - 构建有效的推荐上下文
  • 呈现模式 - 置信度解读、解释结构

The Empty Context Call

快速参考

最小可行请求

Calling the API without building context first.
Instead: Always gather preferences, constraints, and history before requesting recommendations.
json
POST /v1/recommend
Headers: X-API-Key: your-key

{
  "vertical": "movies",
  "context": {
    "preferences": ["at least one preference"]
  },
  "count": 5
}

The Raw Dump

完整请求

Presenting API response directly without personalization.
Instead: Interpret confidence scores and craft explanations that connect to the person's stated preferences.
json
POST /v1/recommend
{
  "vertical": "movies",
  "context": {
    "preferences": ["dark comedies", "complex characters"],
    "profile": "Values authenticity. Drawn to outsider narratives...",
    "constraints": {
      "max_length_minutes": 120,
      "release_year_min": 2010
    },
    "history": [
      {"item": "Parasite", "rating": 5, "id": "tt6751668"},
      {"item": "The Lobster", "rating": 4, "id": "tt3464902"}
    ]
  },
  "count": 5,
  "explain": true
}

The Overconfident Low-Score

置信度快速指南

Presenting weak matches (confidence < 0.5) with the same confidence as strong ones.
Instead: Either omit low-confidence recommendations or clearly caveat them.
评分操作
≥0.9优先推荐,高度匹配
0.7-0.9自信地纳入推荐
0.5-0.7纳入并附带说明
<0.5省略或附带大量说明

The Ignored Constraint

Missing or misremembering stated constraints (budget, dietary, etc.).
Instead: Capture constraints explicitly and verify before each API call.

The Context Amnesia

Not maintaining context across conversation turns.
Instead: Accumulate preferences, history, and constraints throughout the conversation.

The Explanation Vacuum

Recommending without explaining why.
Instead: Every recommendation should include a personalized explanation connecting to stated preferences.

The Feedback Ignore

Not using negative feedback to improve subsequent recommendations.
Instead: When something misses, ask what went wrong and adjust context accordingly.

References

Detailed guides:
  • API Reference - Full endpoint documentation, parameters, responses
  • Context Patterns - Building effective recommendation context
  • Presentation Patterns - Confidence interpretation, explanation structure

Quick Reference

Minimum Viable Request

json
POST /v1/recommend
Headers: X-API-Key: your-key

{
  "vertical": "movies",
  "context": {
    "preferences": ["at least one preference"]
  },
  "count": 5
}

Full Request

json
POST /v1/recommend
{
  "vertical": "movies",
  "context": {
    "preferences": ["dark comedies", "complex characters"],
    "profile": "Values authenticity. Drawn to outsider narratives...",
    "constraints": {
      "max_length_minutes": 120,
      "release_year_min": 2010
    },
    "history": [
      {"item": "Parasite", "rating": 5, "id": "tt6751668"},
      {"item": "The Lobster", "rating": 4, "id": "tt3464902"}
    ]
  },
  "count": 5,
  "explain": true
}

Confidence Quick Guide

ScoreAction
≥0.9Lead recommendation, strong match
0.7-0.9Include confidently
0.5-0.7Include with caveats
<0.5Omit or heavily caveat