# Examples missing for the Flow documentation

**URL:** <https://community.crewai.com/t/examples-missing-for-the-flow-documentation/1630>\
**Category:** CrewAI Community Support\
**Tags:** crewai\
**Created:** [November 26, 2024, 9:19am UTC](https://community.crewai.com/t/examples-missing-for-the-flow-documentation/1630 "2024-11-26T09:19:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![horachka](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/horachka/32/1037_2.png) [@horachka](https://community.crewai.com/u/horachka)\
**Post date:** [November 26, 2024, 9:19am UTC](https://community.crewai.com/t/examples-missing-for-the-flow-documentation/1630/1 "2024-11-26T09:19:39Z")

</div>

Hi! Seems like there are no code examples for [Flows - CrewAI](https://docs.crewai.com/concepts/flows), even though they are being reffered to through the text. For example, it says

> In the above example, we have created a simple Flow that generates a random city using OpenAI and then generates a fun fact about that city. The Flow consists of two tasks: `generate_city` and `generate_fun_fact`.

while the example above being just

```auto
# Existing example code

```

---

<div class="post-metadata">

**Author:** ![rokbenko](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/rokbenko/32/492_2.png) [@rokbenko](https://community.crewai.com/u/rokbenko)\
**Post date:** [November 26, 2024, 11:07am UTC](https://community.crewai.com/t/examples-missing-for-the-flow-documentation/1630/2 "2024-11-26T11:07:14Z")

</div>

@horachka This is a bug in the docs. I remembered seeing this example in the docs, so I tracked it down by searching through GitHub [commits](https://github.com/crewAIInc/crewAI/blob/8bc07e60711b79ad97d30463f3964f90f5a71c06/docs/concepts/flows.mdx).

Here you go:

```
from crewai.flow.flow import Flow, listen, start
from dotenv import load_dotenv
from litellm import completion

class ExampleFlow(Flow):
    model = "gpt-4o-mini"

    @start()
    def generate_city(self):
        print("Starting flow")

        response = completion(
            model=self.model,
            messages=[
                {
                    "role": "user",
                    "content": "Return the name of a random city in the world.",
                },
            ],
        )

        random_city = response["choices"][0]["message"]["content"]
        print(f"Random City: {random_city}")

        return random_city

    @listen(generate_city)
    def generate_fun_fact(self, random_city):
        response = completion(
            model=self.model,
            messages=[
                {
                    "role": "user",
                    "content": f"Tell me a fun fact about {random_city}",
                },
            ],
        )

        fun_fact = response["choices"][0]["message"]["content"]
        return fun_fact

flow = ExampleFlow()
result = flow.kickoff()

print(f"Generated fun fact: {result}")

```

@matt @tonykipkemboi Either the code snippet should be added to the docs, or the text referencing this example should be removed from the docs.

---

<div class="post-metadata">

**Author:** ![horachka](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/horachka/32/1037_2.png) [@horachka](https://community.crewai.com/u/horachka)\
**Post date:** [November 26, 2024, 7:17pm UTC](https://community.crewai.com/t/examples-missing-for-the-flow-documentation/1630/3 "2024-11-26T19:17:42Z")

</div>

Thanks! I couldn’t find it on git

---

<div class="post-metadata">

**Author:** ![rokbenko](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/rokbenko/32/492_2.png) [@rokbenko](https://community.crewai.com/u/rokbenko)\
**Post date:** [November 26, 2024, 9:06pm UTC](https://community.crewai.com/t/examples-missing-for-the-flow-documentation/1630/4 "2024-11-26T21:06:08Z")

</div>

@horachka You’re welcome! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/1X/ecda97e72f77c7100e0a761444b1c991925cc789.png) [@system](https://community.crewai.com/u/system)\
**Post date:** [November 27, 2024, 9:06pm UTC](https://community.crewai.com/t/examples-missing-for-the-flow-documentation/1630/5 "2024-11-27T21:06:22Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
