Back to prompt library
Develop Personalized Recommendation Logic with pgvector
Linked challenge: Agent for Ethical, Personalized Content Recommendation
Prompt source
implementation1 lines1 sectionsNo variables0 checklist items
Design the logic for a `RecommendationAgent` that fetches a user's reading history and preferences, generates embeddings for the current article and user profile, and then queries a PostgreSQL database with pgvector for similar articles. The agent should then generate a list of `RecommendationItem` objects. Describe how you would create and query the pgvector index, and provide conceptual Python code for the agent's core recommendation logic.