Skip to content

Commit

Permalink
Merge pull request #333 from PrefectHQ/mem-ex
Browse files Browse the repository at this point in the history
Fix spacing
  • Loading branch information
jlowin authored Sep 24, 2024
2 parents 285c0b9 + eec29f9 commit 68c2b43
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/examples/features/memory.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,35 @@ In this example, we'll create a simple workflow that remembers a user's favorite
```python
import controlflow as cf


# Create a memory module for user preferences
user_preferences = cf.Memory(
key="user_preferences",
instructions="Store and retrieve user preferences."
)


# Create an agent with access to the memory
agent = cf.Agent(memories=[user_preferences])


# Create a flow to ask for the user's favorite color
@cf.flow
def remember_color():
return cf.run(
"Ask the user for their favorite color and store it in memory",
agents=[agent],
interactive=True,
result_type=str
)


# Create a flow to recall the user's favorite color
@cf.flow
def recall_color():
return cf.run(
"What is the user's favorite color?",
agents=[agent],
result_type=str
)

```

Ordinarily, running the flows above would result in two separate -- unconnected -- conversations. The agent in the `recall_color` flow would have no way of knowing about the information from the first flow, even though its the same agent, because the conversation histories are not shared.
Expand Down

0 comments on commit 68c2b43

Please sign in to comment.