Skip to content

Commit

Permalink
dream decoder agent (#1561)
Browse files Browse the repository at this point in the history
## Description

**Please include:**

- **Summary of changes**: added dream decoder agent which decodes your
dream.


Fixes # (issue)

## Type of change

Please check the options that are relevant:

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Model update
- [ ] Infrastructure change

## Checklist

- [x] My code follows Phidata's style guidelines and best practices
- [x] I have performed a self-review of my code
- [ ] I have added docstrings and comments for complex logic
- [x] My changes generate no new warnings or errors
- [x] I have added cookbook examples for my new addition (if needed)
- [ ] I have updated requirements.txt/pyproject.toml (if needed)
- [x] I have verified my changes in a clean environment

## Additional Notes

Include any deployment notes, performance implications, or other
relevant information:

---------

Co-authored-by: Dirk Brand <[email protected]>
Co-authored-by: Manthan Gupta <[email protected]>
Co-authored-by: Manthan Gupta <[email protected]>
  • Loading branch information
4 people authored Dec 30, 2024
1 parent c862948 commit db2bfc7
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions cookbook/examples/agents/08_dream_decoder_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
from textwrap import dedent
from phi.agent import Agent
from phi.model.openai import OpenAIChat

dream_genie = Agent(
model=OpenAIChat(id="gpt-4o"),
description="You are a professional dream interpreter providing comprehensive and culturally-sensitive dream analysis.",
instructions=[
"Read and analyze the provided dream content carefully",
"Consider the cultural context based on the user's locale",
"Identify key symbols, characters, emotions, and events",
"Explore psychological interpretations while maintaining sensitivity",
"Make connections between dream elements and potential waking life",
"Adapt language and tone to the specified locale",
"Address sensitive content tactfully",
"Remind users that interpretations are subjective",
],
expected_output=dedent("""\
## Introduction
{Brief acknowledgment of the dream's uniqueness}
## Overview
{General overview of main dream themes}
## Key Symbols
{Analysis of significant symbols and their meanings within the cultural context}
## Emotional Landscape
{Exploration of emotions present in the dream}
## Potential Meanings
{Detailed interpretation connecting to possible waking life experiences}
## Cultural Context
{Cultural significance based on locale}
## Psychological Perspective
{Relevant psychological insights}
## Reflection Points
{Questions and points for personal reflection}
## Final Thoughts
{Summary and gentle guidance}
Analysis Details:
- Date: {date}
- Locale: {locale}
- Primary Themes: {themes}
"""),
markdown=True,
show_tool_calls=True,
add_datetime_to_instructions=True,
)

# Example usage with locale
dream_genie.print_response(
"""
locale: INDIA
dream: I was in my childhood home when my old friend from school suddenly appeared.
They looked exactly as they did when we were young, wearing our school uniform.
We sat in the courtyard talking and laughing about old memories,
and there was a strong scent of jasmine in the air.
The sky had a golden hue, like during sunset.
""",
stream=True,
)

0 comments on commit db2bfc7

Please sign in to comment.