Media to Persona

Transform any media content—text posts, images, or other formats—into rich, detailed personas. This powerful feature enables you to analyze user-generated content and create representative personas for your target audience.

Generate from Social Media Posts

Analyze social media content to understand your audience:

social-media-persona.ts
1import { PersonaBuilder } from '@jamesaphoenix/persona-sdk';
2
3// Generate persona from a social media post
4const post = `Just crushed a 10k run this morning! 🏃‍♂️
5Feeling amazing. Time to refuel with a protein smoothie and
6get some coding done. #morningrun #developerlife`;
7
8const persona = await PersonaBuilder.fromPost(post, {
9 apiKey: process.env.OPENAI_API_KEY,
10 platform: 'twitter' // Optional: twitter, instagram, linkedin
11});
12
13console.log(persona.toObject());
14// Result:
15// {
16// name: 'Alex Chen',
17// age: 28,
18// occupation: 'Software Developer',
19// interests: ['running', 'fitness', 'coding', 'healthy eating'],
20// lifestyle: 'health-conscious, early riser, tech professional',
21// personality: 'motivated, disciplined, achievement-oriented'
22// }

Generate from Images

Create personas by analyzing image content:

image-persona.ts
1// Generate persona from image analysis
2const imageUrl = 'https://example.com/user-photo.jpg';
3
4const persona = await PersonaBuilder.fromImage(imageUrl, {
5 apiKey: process.env.OPENAI_API_KEY,
6 analyzeFor: ['demographics', 'interests', 'lifestyle']
7});
8
9// Or from local file
10const persona = await PersonaBuilder.fromImageFile('./photo.jpg', {
11 apiKey: process.env.OPENAI_API_KEY
12});
13
14// Batch processing for multiple images
15const photos = ['photo1.jpg', 'photo2.jpg', 'photo3.jpg'];
16const personas = await PersonaBuilder.fromImages(photos, {
17 apiKey: process.env.OPENAI_API_KEY,
18 groupAnalysis: true // Analyze as a cohesive group
19});

Multi-Media Analysis

Combine multiple media sources for richer personas:

multi-media-analysis.ts
1import { MediaAnalyzer, PersonaBuilder } from '@jamesaphoenix/persona-sdk';
2
3// Analyze multiple content pieces from one user
4const analyzer = new MediaAnalyzer({
5 apiKey: process.env.OPENAI_API_KEY
6});
7
8// Add various media types
9analyzer.addPost('Love exploring new coffee shops while working on my startup!');
10analyzer.addImage('workspace-photo.jpg');
11analyzer.addPost('Just launched our MVP! 3 months of hard work paying off 🚀');
12analyzer.addBio('Entrepreneur | Coffee Enthusiast | Building the future');
13
14// Generate comprehensive persona
15const persona = await analyzer.generatePersona({
16 confidence: 'high', // Require high confidence in attributes
17 includeInferred: true // Include inferred attributes
18});
19
20console.log(persona.toObject());
21// Result includes deep insights from all media sources

Content Categories

📝 Text Content

  • • Social media posts
  • • Blog comments
  • • Reviews and feedback
  • • Forum discussions
  • • Chat messages

🖼️ Visual Content

  • • Profile photos
  • • Lifestyle images
  • • Product interactions
  • • Environment context
  • • Activity photos

Advanced Options

Fine-tune media analysis with advanced configuration:

advanced-media-options.ts
1const persona = await PersonaBuilder.fromPost(content, {
2 apiKey: process.env.OPENAI_API_KEY,
3
4 // Analysis options
5 extractSentiment: true,
6 detectPersonality: true,
7 inferDemographics: true,
8
9 // Confidence thresholds
10 minConfidence: 0.7,
11 requireExplicitMentions: false,
12
13 // Context hints
14 domain: 'fitness', // Help focus the analysis
15 ageRange: [20, 40], // Constrain demographics
16
17 // Output control
18 includeRawAnalysis: true,
19 generateBackground: true
20});
21
22// Access detailed analysis
23console.log(persona.attributes.sentiment); // positive, neutral, negative
24console.log(persona.attributes.personalityTraits); // Big 5 traits
25console.log(persona.attributes.confidence); // Confidence scores

✨ Best Practices

  • Privacy First: Always respect user privacy and obtain consent
  • Multiple Sources: Combine different media types for accuracy
  • Context Matters: Provide domain hints for better results
  • Validate Results: Cross-reference with known demographics
  • Batch Processing: Use batch methods for efficiency