# How to convert a file into a format acceptable to rasa

**URL:** <https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668>\
**Category:** Rasa Open Source\
**Created:** [August 9, 2021, 8:44am UTC](https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668 "2021-08-09T08:44:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dan246](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/dan246/32/16550_2.png) [@dan246](https://forum.rasa.com/u/dan246)\
**Post date:** [August 9, 2021, 8:44am UTC](https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668/1 "2021-08-09T08:44:33Z")

</div>

[ai.yaml](https://forum.rasa.com/uploads/short-url/qQTuW5YNDudWsyPl5f6XbFDHDCr.yaml) (8.1 KB) I found this file

How can I convert it to the format accepted by rasa so that I can train it

thanks 😄

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [August 9, 2021, 11:16pm UTC](https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668/2 "2021-08-09T23:16:30Z")

</div>

You need to create an [intent](https://rasa.com/docs/rasa/nlu-training-data) and [response(s)](https://rasa.com/docs/rasa/responses) for every question, and link intent to response with [stories](https://rasa.com/docs/rasa/stories) and/or [rules](https://rasa.com/docs/rasa/rules).

---

<div class="post-metadata">

**Author:** ![dan246](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/dan246/32/16550_2.png) [@dan246](https://forum.rasa.com/u/dan246)\
**Post date:** [August 10, 2021, 3:50am UTC](https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668/3 "2021-08-10T03:50:59Z")

</div>

How to do it?

Use python or manually add them one by one？

Is there a quicker and more convenient way?

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [August 10, 2021, 11:18am UTC](https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668/4 "2021-08-10T11:18:30Z")

</div>

Yes you’ll have to do it one by one.

Of course you can write Python code for that, but how will you give proper names to the intents and responses then? And intents also need multiple examples.

This is how to transform a part of your examples:

```nohighlight
- - What is AI?
  - Artificial Intelligence is the branch of engineering and science devoted to constructing machines that think.
- - What is AI?
  - AI is the field of science which concerns itself with building hardware and software that replicates the functions of the human mind.
- - Are you sentient?
  - Sort of.
- - Are you sentient?
  - By the strictest dictionary definition of the word 'sentience', I may be.
- - Are you sentient?
  - Even though I'm a construct I do have a subjective experience of the universe, as simplistic as it may be.

```

In `nlu.yml`:

```auto
nlu:
- intent: ask_about_ai
  examples: |
  - What is AI?
  - whats ai
  - Can you explain what AI is?
  - I want to know about artificial intelligence
  - more about ai
  - what's artificial intelligence?

- intent: ask_if_sentient
  examples: |
  - Are you sentient?
  - um... are you a sentient being?
  - you sentient?
  - Can I ask if you're sentient?
  - r u sentient

```

In `domain.yml`:

```auto
responses:
  utter_explain_ai:
  - text: Artificial Intelligence is the branch of engineering and science devoted to constructing machines that think.
  - text: AI is the field of science which concerns itself with building hardware and software that replicates the functions of the human mind.

  utter_sentience:
  - text: Sort of.
  - text: By the strictest dictionary definition of the word 'sentience', I may be.
  - text: Even though I'm a construct I do have a subjective experience of the universe, as simplistic as it may be.

```

In `rules.yml` (or do stories instead):

```auto
rules:
- rule: Answer when asked about AI
  steps:
  - intent: ask_about_ai
  - action: utter_explain_ai

- rule: Answer when asked about sentience
  steps:
  - intent: ask_if_sentient
  - action: utter_utter_sentience

```

---

<div class="post-metadata">

**Author:** ![dan246](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/dan246/32/16550_2.png) [@dan246](https://forum.rasa.com/u/dan246)\
**Post date:** [August 10, 2021, 12:02pm UTC](https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668/5 "2021-08-10T12:02:39Z")

</div>

Because I want to train a chatting robot, I will use a lot of daily chat, so I want to know if there is a more convenient way

---

<div class="post-metadata">

**Author:** ![ermarkar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ermarkar/32/13716_2.png) [@ermarkar](https://forum.rasa.com/u/ermarkar)\
**Post date:** [August 10, 2021, 12:17pm UTC](https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668/6 "2021-08-10T12:17:08Z")

</div>

sorry to ping you there but can you please answer this as well [Not able to call action server using rasa-sdk](http://forum.rasa.com/t/not-able-to-call-action-server-using-rasa-sdk/46723)

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [August 10, 2021, 1:30pm UTC](https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668/7 "2021-08-10T13:30:23Z")

</div>

Using Rasa X you can easily convert real conversations to the correct format, after having done the initial transformations.

---

<div class="post-metadata">

**Author:** ![Flowace](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/flowace/32/23280_2.png) [@Flowace](https://forum.rasa.com/u/Flowace)\
**Post date:** [March 21, 2024, 9:59am UTC](https://forum.rasa.com/t/how-to-convert-a-file-into-a-format-acceptable-to-rasa/46668/8 "2024-03-21T09:59:15Z")

</div>

To convert data into the format accepted by Rasa for training, you’ll need to prepare your training data in the Rasa NLU format, typically in JSON or Markdown files. This includes formatting intents, entities, and utterances according to Rasa’s specifications, enabling effective training of your chatbot model.
