Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skill for creating tables in Asciidoc format #187

Closed
wants to merge 1 commit into from
Closed

Add skill for creating tables in Asciidoc format #187

wants to merge 1 commit into from

Conversation

grdryn
Copy link
Contributor

@grdryn grdryn commented Mar 8, 2024

Describe the contribution to the taxonomy

  • Currently the merlinite model generates a markdown table when asked to generate an asciidoc table. This skill attempts to teach it how to generate Asciidoc tables.
  • I'm not sure about the path I've put the qna.yaml in here, please let me know if it should be somewhere else.

I'll give several examples below of various questions asked before and after, and will also include an image showing the before and after rendered in an HTML page that was rendered from trying to interpret the responses as Asciidoc.

Try it out yourself!
I've put the trained model from lab train onto Google Drive, so that you can download it and ask your own questions, and not just rely on the examples that I've provided below. You can find it here (note that it's 13.5GB):
https://drive.google.com/file/d/12JJhsZPWQxXZb-WZZUof_Cit2t09Y84n/view?usp=sharing

Contribution checklist

  • tested contribution with lab generate
  • lab generate does not produce any warnings or errors
  • all commits are signed off (DCO)
  • the qna.yaml file was linted

Example 1

Create an AsciiDoc table showing the IMDB top 5 movies, including the year they were released, and their IMDB rating

Response that was received

.. csv-table:: Top 5 IMDb Movies of All Time
   :header: Title, Year, IMDb Rating

"The Godfather", 1972, 9.2
"The Shawshank Redemption", 1994, 9.3
"The Godfather: Part II", 1974, 9.0
"Pulp Fiction", 1994, 8.9
"The Dark Knight", 2008, 9.0

Response that is now received instead

Here's the AsciiDoc code for the table:

.IMDB Top 5 Movies
[%header]
|===
| Movie | Year | Rating
| The Godfather | 1972 | 9.2
| The Shawshank Redemption | 1994 | 9.3
| The Dark Knight | 2008 | 9.0
| Pulp Fiction | 1994 | 8.9
| Forrest Gump | 1994 | 8.8
|===

The rendered HTML output will look like this:

IMDB Top 5 Movies

| Movie | Year | Rating
| The Godfather | 1972 | 9.2
| The Shawshank Redemption | 1994 | 9.3
| The Dark Knight | 2008 | 9.0
| Pulp Fiction | 1994 | 8.9
| Forrest Gump | 1994 | 8.8

Example screenshot of before and after as rendered HTML from an Asciidoc processor on the responses

Example 2

Create an Asciidoc-formatted table with 4 rows and two columns, where the first column is a random letter, and the second column is a random number between 1 and 4.

Response that was received

Certainly! I can help you create a randomized AsciiDoc table with the specified structure. However, please note that I am an AI language model and do not have the ability to generate truly random values. I will provide you with a set of random values that you can use for the table.
Here's an example of how the table might look:

= Table: Random Letters and Numbers

| Random Letter | Random Number |
| --- | --- |
| A | 1 |
| B | 2 |
| C | 3 |
| D | 4 |

Feel free to replace the provided values with your own random letters and numbers. If you need help generating random values, you can use an online random number generator or a programming language to create the values for the table.

Response that is now received instead

Here's the AsciiDoc code for the table:

.Table Example
[%header]
|===
| Column 1 | Column 2
| A | 1
| B | 2
| C | 3
| D | 4
|===

The rendered HTML output will look like this:

Table Example

| Column 1 | Column 2
| A | 1
| B | 2
| C | 3
| D | 4

Example screenshot of before and after as rendered HTML from an Asciidoc processor on the responses

Example 3

Convert the following Markdown table to AsciiDoc:

| First name | Last name    | Age | Score |
| ---------- | ---------    | --- | ----- |
| Alice      | O'Wonderland | 20  | 53    |
| Bob        | Tables       | 10  | null  |
| Carol      | Basking      | 60  | 25    |
| Dave       | Letterbox    | 55  | 40    |
Response that was received

Here's the AsciiDoc version of the table:

.. csv-table:: Table: Users' Information
:header-rows: 1

"First name", "Last name", "Age", "Score"
"Alice", "O'Wonderland", "20", "53"
"Bob", "Tables", "10", "null"
"Carol", "Basking", "60", "25"
"Dave", "Letterbox", "55", "40"

The table is created using the csv-table directive, which is suitable for simple tables like this one.

Response that is now received instead

Here is the equivalent AsciiDoc equivalent:

.Table: Students' Information
[%header]
|===

First Name Last Name Age Score
Alice O'Wonderland 20 53
Bob Tables 10 null
Carol Basking 60 25
Dave Letterbox 55 40
===

Note that the header row is formatted in brackets, and the rows that follow it use the "|" delimiter to indicate the
column contents. The table is surrounded by "|===" lines to define the table boundaries.

Example screenshot of before and after as rendered HTML from an Asciidoc processor on the responses

Example 4

Given the following csv file contents, how could it be represented as an asciidoc table?
1,2,3,4
5,6,7,8
9,10,11,12

Response that was received

To represent the given CSV file contents as an ASCIIDOC table, you can use the `table()` directive along with the `row()` macro. Here's a sample ASCIIDOC code that creates a table from the given CSV data:

=table

:name: table-csv
:source: csv-file.csv
:header: 1,2,3,4

=table

::
:source: table-csv
::row()
1,2,3,4
::row()
5,6,7,8
::row()
9,10,11,12

In this example, the table() directive is used to define a table with a given width for each column. The :source attribute is used to specify the name of the CSV file that contains the data for the table. The :header attribute is used to specify the header row of the CSV
file. The row() macro is then used to add rows to the table.

This will result in the following table:

1 2 3 4
5 6 7 8
9 10 11 12
Response that is now received instead

Here's the asciidoc code for the table:

.Table: CSV Data
[%header]
|===

Column 1 Column 2 Column 3 Column 4
1 2 3 4
5 6 7 8
9 10 11 12
===

The asciidoc table is now represented using the .Table: CSV Data header, and the rows and columns are defined using the |
row/column label | data coordinates format. The data coordinates indicate the position of the data in the table.

Example screenshot of before and after as rendered HTML from an Asciidoc processor on the responses

Example 5

What is the syntax for creating an Asciidoc table?

Response that was received

In Asciidoc, you can create a table using the `table` directive, followed by rows and columns defined using pipelines (`|`) to separate cells. Here's a simple example of an Ascidoc table:
=table | row1col1, row1col2, row1col3, row1col4, row1col5 | row2col1, row2col2, row2col3, row2col4, row2col5 | ...]

This creates a table with five headers and multiple rows. Each row contains five cells separated by pipelines. If you want to create a simple two-column table, you can use this syntax:

=table | row1col1, row1col2 | row2col1, row2col2 | ...]

In this example, header1 and header2 are the headers of the two columns, and row1col1, row1col2, row2col1, and row2col2 are the cells of the two rows. You can replace these placeholders with your desired content.

Keep in mind that Asciidoc tables support various formatting options, such as aligning cells, merging cells, and using different table styles. For more information on these features, refer to the official Asciidoctor documentation or use a search engine to find additional resources
on Asciidoctor tables.

Response that is now received instead

Here's the syntax for creating an Asciidoc table:

.. Table: Example Table - Asciidoc Syntax
:name: ascii-table-syntax
:widths: 20, 80

|===

Column1 Column2
Value1 Content
Value2 Of the
second
column
--------- ---------
===

The table has the following structure:

  • The first line starts with the "|===" delimiter, followed by the table name, widths, and widths parameters (if needed).
  • Each subsequent line starts with the "|" delimiter, followed by the column labels or values.
  • The table ends with the "|===" delimiter.

The widths parameter is used to specify the width of each column in terms of the number of characters. If not provided,
the widths will be automatically calculated based on the longest label or value for each column.

Here's the AsciiDoc code for the example table:

.Table: AsciiDoc Table Syntax
[%header]
:name: ascii-table-syntax
:widths: 20, 80
|===

Column1 Column2
Value1 Content
Value2 Of the
second
column
--------- ---------
===

The rendered HTML output will display the table with the given structure and content.

Example screenshot of before and after as rendered HTML from an Asciidoc processor on the responses

@grdryn grdryn requested a review from a team as a code owner March 8, 2024 02:15
@grdryn
Copy link
Contributor Author

grdryn commented Mar 12, 2024

I've fixed the issues with this by adding more examples. lab generate produced better results, and as can be seen in the description here, the new output is reasonable.

@grdryn
Copy link
Contributor Author

grdryn commented Mar 12, 2024

I've added a screenshot of a rendered Asciidoc page to the description, showing the difference between the before and after of an example request to create an asciidoc table.

@grdryn
Copy link
Contributor Author

grdryn commented Mar 13, 2024

Review comments addressed, but it looks like the bar has been raised, so I'll need to add another example:

Error: ERROR: compositional_skills/extraction/inference/quantitative/asciidoc/tables/qna.yaml:4:1: less than 5 'seed_examples'

@grdryn
Copy link
Contributor Author

grdryn commented Mar 13, 2024

Updated with a new example to fulfill the new requirements. All checks pass again now.

@grdryn grdryn requested a review from a team as a code owner March 14, 2024 13:28
Signed-off-by: Gerard Ryan <git@grdryn.xyz>
@n1hility
Copy link
Member

Thank you for your contribution to InstructLab! Unfortunately, once a Github repo is made public, all open PRs are automatically closed since they link against a private repo. We have detected that your PR might have been one of the ones affected by this change. If you are still interested in contributing your improvement, please fill out the following short form by no later than May 3rd, and we will get back to you with the additional steps necessary once we have had time to assess the PRs of those still interested:

https://forms.gle/V7SrPPMZDo6iGDYu8

jjasghar pushed a commit that referenced this pull request Jun 5, 2024
This is a re-submission of #187.

If your PR is related to a contribution to the taxonomy, please, fill
out the following questionnaire. If not, replace this whole text and the
following questionnaire with whatever information is applicable to your
PR.


**Describe the contribution to the taxonomy**

<!-- A concise description of what the contribution brings, replace
"..." in the bullet list -->

- Currently the merlinite model generates a markdown table when asked to
generate an asciidoc table. This skill attempts to teach it how to
generate Asciidoc tables.
- I'm not sure about the path I've put the qna.yaml in here, please let
me know if it should be somewhere else.

I'll give several examples below of various questions asked before and
after, and will also include an image showing the before and after
rendered in an HTML page that was rendered from trying to interpret the
responses as Asciidoc.

**Try it out yourself!**
I've put the trained model from `lab train` onto Google Drive, so that
you can download it and ask your own questions, and not just rely on the
examples that I've provided below. You can find it here (note that it's
13.5GB):

https://drive.google.com/file/d/12JJhsZPWQxXZb-WZZUof_Cit2t09Y84n/view?usp=sharing


**Input given at the prompt**

<!-- What you entered, replace "..." -->
_See examples below the "Contribution checklist" section. I've put them
at the end because some of the Markdown features I've used are a bit
odd, and can cause effects to sections following them._


**Response from the original model**


<!-- What you received from the original model in response to your
input,
replace "..." -->
_See examples below the "Contribution checklist" section. I've put them
at the end because some of the Markdown features I've used are a bit
odd, and can cause effects to sections following them._


**Response from the fine-tuned model**


<!-- Generate a synthetic dataset based on your newly added seed data;
train the model
with the synthetic data and now re-test the model's response with the
same prompt.
Replace "..." with what you receive with the finetuned model. -->
_See examples below the "Contribution checklist" section. I've put them
at the end because some of the Markdown features I've used are a bit
odd, and can cause effects to sections following them._

**Contribution checklist**

<!-- Insert an x between the empty brackets: [ ] >> [x] -->

- [x] The contribution was tested with `ilab generate`
- [x] No errors or warnings were produced by `ilab generate`
- [x] All [commits are signed
off](https://github.com/instructlab/taxonomy/blob/main/CONTRIBUTING.md#legal)
(DCO)
- [x] The `qna.yaml` file contains at least 5 `seed_examples`
- [x] The `qna.yaml` file was [linted](https://yamllint.com) and
[prettified](https://onlineyamltools.com/prettify-yaml)
([yaml-validator](https://jsonformatter.org/yaml-validator) can do both)
- [x] An `attribution.txt` file in the same folder as the `qna.yaml`
file.


----

### Example 1
> Create an AsciiDoc table showing the IMDB top 5 movies, including the
year they were released, and their IMDB rating

<details>
  <summary>Response that was received</summary>
  <pre><code>
.. csv-table:: Top 5 IMDb Movies of All Time
   :header: Title, Year, IMDb Rating

   "The Godfather", 1972, 9.2
   "The Shawshank Redemption", 1994, 9.3
   "The Godfather: Part II", 1974, 9.0
   "Pulp Fiction", 1994, 8.9
   "The Dark Knight", 2008, 9.0
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the AsciiDoc code for the table:

.IMDB Top 5 Movies
[%header]
|===
| Movie         | Year   | Rating
| The Godfather | 1972   | 9.2
| The Shawshank Redemption | 1994   | 9.3
| The Dark Knight | 2008   | 9.0
| Pulp Fiction | 1994   | 8.9
| Forrest Gump | 1994   | 8.8
|===

The rendered HTML output will look like this:

IMDB Top 5 Movies
-----------------

| Movie         | Year   | Rating
| The Godfather | 1972   | 9.2
| The Shawshank Redemption | 1994   | 9.3
| The Dark Knight | 2008   | 9.0
| Pulp Fiction | 1994   | 8.9
| Forrest Gump | 1994   | 8.8
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/77d35479-3b82-41a0-9e0c-c7418f127bb1">
</details>

### Example 2
> Create an Asciidoc-formatted table with 4 rows and two columns, where
the first column is a random letter, and the second column is a random
number between 1 and 4.

<details>
  <summary>Response that was received</summary>
  <pre><code>

Certainly! I can help you create a randomized AsciiDoc table with the
specified structure. However, please note that I am an AI language model
and do not have the ability to generate truly random values. I will
provide you with a set of random values that you can use for the table.
Here's an example of how the table might look:

```
= Table: Random Letters and Numbers

| Random Letter | Random Number |
| --- | --- |
| A | 1 |
| B | 2 |
| C | 3 |
| D | 4 |
```

Feel free to replace the provided values with your own random letters
and numbers. If you need help generating random values, you can use an
online random number generator or a programming language to create the
values for the table.

</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the AsciiDoc code for the table:

.Table Example
[%header]
|===
| Column 1   | Column 2
| A          | 1
| B          | 2
| C          | 3
| D          | 4
|===

The rendered HTML output will look like this:

Table Example
-------------

| Column 1   | Column 2
| A          | 1
| B          | 2
| C          | 3
| D          | 4
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/f4352bb1-fa78-4169-9756-2ccff0d8db01">
</details>

### Example 3
> Convert the following Markdown table to AsciiDoc:
> 
>     | First name | Last name    | Age | Score |
>     | ---------- | ---------    | --- | ----- |
>     | Alice      | O'Wonderland | 20  | 53    |
>     | Bob        | Tables       | 10  | null  |
>     | Carol      | Basking      | 60  | 25    |
>     | Dave       | Letterbox    | 55  | 40    |


<details>
  <summary>Response that was received</summary>
  <pre><code>
Here's the AsciiDoc version of the table:

.. csv-table:: Table: Users' Information
   :header-rows: 1

   "First name", "Last name", "Age", "Score"
   "Alice", "O'Wonderland", "20", "53"
   "Bob", "Tables", "10", "null"
   "Carol", "Basking", "60", "25"
   "Dave", "Letterbox", "55", "40"

The table is created using the ``csv-table`` directive, which is
suitable for simple tables like this one.
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here is the equivalent AsciiDoc equivalent:

.Table: Students' Information
[%header]
|===
| First Name  | Last Name    | Age | Score
| ----------- | ------------ | --- | -----
| Alice       | O'Wonderland | 20  | 53
| Bob         | Tables       | 10  | null
| Carol       | Basking      | 60  | 25
| Dave        | Letterbox    | 55  | 40
|===

Note that the header row is formatted in brackets, and the rows that
follow it use the "|" delimiter to indicate the
column contents. The table is surrounded by "|===" lines to define the
table boundaries.
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/28d56989-76a7-42f6-9946-72b9e96fbdf1">
</details>

### Example 4
> Given the following csv file contents, how could it be represented as
an asciidoc table?
1,2,3,4
5,6,7,8
9,10,11,12


<details>
  <summary>Response that was received</summary>
  <pre><code>
To represent the given CSV file contents as an ASCIIDOC table, you can
use the `table()` directive along with the `row()` macro. Here's a
sample ASCIIDOC code that creates a table from the given CSV data:

=table
----
:name: table-csv
:source: csv-file.csv
:header: 1,2,3,4

=table
----
::
    :source: table-csv
::row()
1,2,3,4
::row()
5,6,7,8
::row()
9,10,11,12

In this example, the `table()` directive is used to define a table with
a given width for each column. The `:source` attribute is used to
specify the name of the CSV file that contains the data for the table.
The `:header` attribute is used to specify the header row of the CSV
file. The `row()` macro is then used to add rows to the table.

This will result in the following table:

| 1 | 2 | 3 | 4 |
| - | - | - | - |
| 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 |
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the asciidoc code for the table:

.Table: CSV Data
[%header]
|===
| Column 1 | Column 2 | Column 3 | Column 4
|----------|----------|----------|----------
| 1        | 2        | 3        | 4
| 5        | 6        | 7        | 8
| 9        | 10       | 11       | 12
|===

The asciidoc table is now represented using the .Table: CSV Data header,
and the rows and columns are defined using the |
row/column label | data coordinates format. The data coordinates
indicate the position of the data in the table.
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/b127929f-5705-4049-84d9-ee9ff7e01bf4">
</details>

### Example 5
> What is the syntax for creating an Asciidoc table?

<details>
  <summary>Response that was received</summary>
  <pre><code>
In Asciidoc, you can create a table using the `table` directive,
followed by rows and columns defined using pipelines (`|`) to separate
cells. Here's a simple example of an Ascidoc table:

```
=table | row1col1, row1col2, row1col3, row1col4, row1col5 | row2col1, row2col2, row2col3, row2col4, row2col5 | ...]
```

This creates a table with five headers and multiple rows. Each row
contains five cells separated by pipelines. If you want to create a
simple two-column table, you can use this syntax:

```
=table | row1col1, row1col2 | row2col1, row2col2 | ...]
```

In this example, `header1` and `header2` are the headers of the two
columns, and `row1col1`, `row1col2`, `row2col1`, and `row2col2` are the
cells of the two rows. You can replace these placeholders with your
desired content.

Keep in mind that Asciidoc tables support various formatting options,
such as aligning cells, merging cells, and using different table styles.
For more information on these features, refer to the official
Asciidoctor documentation or use a search engine to find additional
resources
on Asciidoctor tables.
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the syntax for creating an Asciidoc table:

.. Table: Example Table - Asciidoc Syntax
:name: ascii-table-syntax
:widths: 20, 80

|===
| Column1 | Column2 |
|---------|---------|
| Value1  | Content |
| Value2  | Of the |
|         | second |
|         | column |
|---------|---------|
|===

The table has the following structure:

- The first line starts with the "|===" delimiter, followed by the table
name, widths, and widths parameters (if needed).
- Each subsequent line starts with the "|" delimiter, followed by the
column labels or values.
- The table ends with the "|===" delimiter.

The widths parameter is used to specify the width of each column in
terms of the number of characters. If not provided,
the widths will be automatically calculated based on the longest label
or value for each column.

Here's the AsciiDoc code for the example table:

.Table: AsciiDoc Table Syntax
[%header]
:name: ascii-table-syntax
:widths: 20, 80
|===
| Column1 | Column2 |
|---------|---------|
| Value1  | Content |
| Value2  | Of the |
|         | second  |
|         | column  |
|---------|---------|
|===

The rendered HTML output will display the table with the given structure
and content.
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/ff21bbcf-54b9-4eed-895e-714ef2eb4492">
</details>

---------

Signed-off-by: Gerard Ryan <git@grdryn.xyz>
Signed-off-by: BJ Hargrave <hargrave@us.ibm.com>
jjasghar pushed a commit to luke-inglis/taxonomy that referenced this pull request Jun 7, 2024
This is a re-submission of instructlab#187.

If your PR is related to a contribution to the taxonomy, please, fill
out the following questionnaire. If not, replace this whole text and the
following questionnaire with whatever information is applicable to your
PR.


**Describe the contribution to the taxonomy**

<!-- A concise description of what the contribution brings, replace
"..." in the bullet list -->

- Currently the merlinite model generates a markdown table when asked to
generate an asciidoc table. This skill attempts to teach it how to
generate Asciidoc tables.
- I'm not sure about the path I've put the qna.yaml in here, please let
me know if it should be somewhere else.

I'll give several examples below of various questions asked before and
after, and will also include an image showing the before and after
rendered in an HTML page that was rendered from trying to interpret the
responses as Asciidoc.

**Try it out yourself!**
I've put the trained model from `lab train` onto Google Drive, so that
you can download it and ask your own questions, and not just rely on the
examples that I've provided below. You can find it here (note that it's
13.5GB):

https://drive.google.com/file/d/12JJhsZPWQxXZb-WZZUof_Cit2t09Y84n/view?usp=sharing


**Input given at the prompt**

<!-- What you entered, replace "..." -->
_See examples below the "Contribution checklist" section. I've put them
at the end because some of the Markdown features I've used are a bit
odd, and can cause effects to sections following them._


**Response from the original model**


<!-- What you received from the original model in response to your
input,
replace "..." -->
_See examples below the "Contribution checklist" section. I've put them
at the end because some of the Markdown features I've used are a bit
odd, and can cause effects to sections following them._


**Response from the fine-tuned model**


<!-- Generate a synthetic dataset based on your newly added seed data;
train the model
with the synthetic data and now re-test the model's response with the
same prompt.
Replace "..." with what you receive with the finetuned model. -->
_See examples below the "Contribution checklist" section. I've put them
at the end because some of the Markdown features I've used are a bit
odd, and can cause effects to sections following them._

**Contribution checklist**

<!-- Insert an x between the empty brackets: [ ] >> [x] -->

- [x] The contribution was tested with `ilab generate`
- [x] No errors or warnings were produced by `ilab generate`
- [x] All [commits are signed
off](https://github.com/instructlab/taxonomy/blob/main/CONTRIBUTING.md#legal)
(DCO)
- [x] The `qna.yaml` file contains at least 5 `seed_examples`
- [x] The `qna.yaml` file was [linted](https://yamllint.com) and
[prettified](https://onlineyamltools.com/prettify-yaml)
([yaml-validator](https://jsonformatter.org/yaml-validator) can do both)
- [x] An `attribution.txt` file in the same folder as the `qna.yaml`
file.


----

### Example 1
> Create an AsciiDoc table showing the IMDB top 5 movies, including the
year they were released, and their IMDB rating

<details>
  <summary>Response that was received</summary>
  <pre><code>
.. csv-table:: Top 5 IMDb Movies of All Time
   :header: Title, Year, IMDb Rating

   "The Godfather", 1972, 9.2
   "The Shawshank Redemption", 1994, 9.3
   "The Godfather: Part II", 1974, 9.0
   "Pulp Fiction", 1994, 8.9
   "The Dark Knight", 2008, 9.0
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the AsciiDoc code for the table:

.IMDB Top 5 Movies
[%header]
|===
| Movie         | Year   | Rating
| The Godfather | 1972   | 9.2
| The Shawshank Redemption | 1994   | 9.3
| The Dark Knight | 2008   | 9.0
| Pulp Fiction | 1994   | 8.9
| Forrest Gump | 1994   | 8.8
|===

The rendered HTML output will look like this:

IMDB Top 5 Movies
-----------------

| Movie         | Year   | Rating
| The Godfather | 1972   | 9.2
| The Shawshank Redemption | 1994   | 9.3
| The Dark Knight | 2008   | 9.0
| Pulp Fiction | 1994   | 8.9
| Forrest Gump | 1994   | 8.8
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/77d35479-3b82-41a0-9e0c-c7418f127bb1">
</details>

### Example 2
> Create an Asciidoc-formatted table with 4 rows and two columns, where
the first column is a random letter, and the second column is a random
number between 1 and 4.

<details>
  <summary>Response that was received</summary>
  <pre><code>

Certainly! I can help you create a randomized AsciiDoc table with the
specified structure. However, please note that I am an AI language model
and do not have the ability to generate truly random values. I will
provide you with a set of random values that you can use for the table.
Here's an example of how the table might look:

```
= Table: Random Letters and Numbers

| Random Letter | Random Number |
| --- | --- |
| A | 1 |
| B | 2 |
| C | 3 |
| D | 4 |
```

Feel free to replace the provided values with your own random letters
and numbers. If you need help generating random values, you can use an
online random number generator or a programming language to create the
values for the table.

</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the AsciiDoc code for the table:

.Table Example
[%header]
|===
| Column 1   | Column 2
| A          | 1
| B          | 2
| C          | 3
| D          | 4
|===

The rendered HTML output will look like this:

Table Example
-------------

| Column 1   | Column 2
| A          | 1
| B          | 2
| C          | 3
| D          | 4
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/f4352bb1-fa78-4169-9756-2ccff0d8db01">
</details>

### Example 3
> Convert the following Markdown table to AsciiDoc:
> 
>     | First name | Last name    | Age | Score |
>     | ---------- | ---------    | --- | ----- |
>     | Alice      | O'Wonderland | 20  | 53    |
>     | Bob        | Tables       | 10  | null  |
>     | Carol      | Basking      | 60  | 25    |
>     | Dave       | Letterbox    | 55  | 40    |


<details>
  <summary>Response that was received</summary>
  <pre><code>
Here's the AsciiDoc version of the table:

.. csv-table:: Table: Users' Information
   :header-rows: 1

   "First name", "Last name", "Age", "Score"
   "Alice", "O'Wonderland", "20", "53"
   "Bob", "Tables", "10", "null"
   "Carol", "Basking", "60", "25"
   "Dave", "Letterbox", "55", "40"

The table is created using the ``csv-table`` directive, which is
suitable for simple tables like this one.
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here is the equivalent AsciiDoc equivalent:

.Table: Students' Information
[%header]
|===
| First Name  | Last Name    | Age | Score
| ----------- | ------------ | --- | -----
| Alice       | O'Wonderland | 20  | 53
| Bob         | Tables       | 10  | null
| Carol       | Basking      | 60  | 25
| Dave        | Letterbox    | 55  | 40
|===

Note that the header row is formatted in brackets, and the rows that
follow it use the "|" delimiter to indicate the
column contents. The table is surrounded by "|===" lines to define the
table boundaries.
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/28d56989-76a7-42f6-9946-72b9e96fbdf1">
</details>

### Example 4
> Given the following csv file contents, how could it be represented as
an asciidoc table?
1,2,3,4
5,6,7,8
9,10,11,12


<details>
  <summary>Response that was received</summary>
  <pre><code>
To represent the given CSV file contents as an ASCIIDOC table, you can
use the `table()` directive along with the `row()` macro. Here's a
sample ASCIIDOC code that creates a table from the given CSV data:

=table
----
:name: table-csv
:source: csv-file.csv
:header: 1,2,3,4

=table
----
::
    :source: table-csv
::row()
1,2,3,4
::row()
5,6,7,8
::row()
9,10,11,12

In this example, the `table()` directive is used to define a table with
a given width for each column. The `:source` attribute is used to
specify the name of the CSV file that contains the data for the table.
The `:header` attribute is used to specify the header row of the CSV
file. The `row()` macro is then used to add rows to the table.

This will result in the following table:

| 1 | 2 | 3 | 4 |
| - | - | - | - |
| 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 |
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the asciidoc code for the table:

.Table: CSV Data
[%header]
|===
| Column 1 | Column 2 | Column 3 | Column 4
|----------|----------|----------|----------
| 1        | 2        | 3        | 4
| 5        | 6        | 7        | 8
| 9        | 10       | 11       | 12
|===

The asciidoc table is now represented using the .Table: CSV Data header,
and the rows and columns are defined using the |
row/column label | data coordinates format. The data coordinates
indicate the position of the data in the table.
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/b127929f-5705-4049-84d9-ee9ff7e01bf4">
</details>

### Example 5
> What is the syntax for creating an Asciidoc table?

<details>
  <summary>Response that was received</summary>
  <pre><code>
In Asciidoc, you can create a table using the `table` directive,
followed by rows and columns defined using pipelines (`|`) to separate
cells. Here's a simple example of an Ascidoc table:

```
=table | row1col1, row1col2, row1col3, row1col4, row1col5 | row2col1, row2col2, row2col3, row2col4, row2col5 | ...]
```

This creates a table with five headers and multiple rows. Each row
contains five cells separated by pipelines. If you want to create a
simple two-column table, you can use this syntax:

```
=table | row1col1, row1col2 | row2col1, row2col2 | ...]
```

In this example, `header1` and `header2` are the headers of the two
columns, and `row1col1`, `row1col2`, `row2col1`, and `row2col2` are the
cells of the two rows. You can replace these placeholders with your
desired content.

Keep in mind that Asciidoc tables support various formatting options,
such as aligning cells, merging cells, and using different table styles.
For more information on these features, refer to the official
Asciidoctor documentation or use a search engine to find additional
resources
on Asciidoctor tables.
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the syntax for creating an Asciidoc table:

.. Table: Example Table - Asciidoc Syntax
:name: ascii-table-syntax
:widths: 20, 80

|===
| Column1 | Column2 |
|---------|---------|
| Value1  | Content |
| Value2  | Of the |
|         | second |
|         | column |
|---------|---------|
|===

The table has the following structure:

- The first line starts with the "|===" delimiter, followed by the table
name, widths, and widths parameters (if needed).
- Each subsequent line starts with the "|" delimiter, followed by the
column labels or values.
- The table ends with the "|===" delimiter.

The widths parameter is used to specify the width of each column in
terms of the number of characters. If not provided,
the widths will be automatically calculated based on the longest label
or value for each column.

Here's the AsciiDoc code for the example table:

.Table: AsciiDoc Table Syntax
[%header]
:name: ascii-table-syntax
:widths: 20, 80
|===
| Column1 | Column2 |
|---------|---------|
| Value1  | Content |
| Value2  | Of the |
|         | second  |
|         | column  |
|---------|---------|
|===

The rendered HTML output will display the table with the given structure
and content.
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/ff21bbcf-54b9-4eed-895e-714ef2eb4492">
</details>

---------

Signed-off-by: Gerard Ryan <git@grdryn.xyz>
Signed-off-by: BJ Hargrave <hargrave@us.ibm.com>
jjasghar pushed a commit to acidonper/taxonomy that referenced this pull request Jun 10, 2024
This is a re-submission of instructlab#187.

If your PR is related to a contribution to the taxonomy, please, fill
out the following questionnaire. If not, replace this whole text and the
following questionnaire with whatever information is applicable to your
PR.


**Describe the contribution to the taxonomy**

<!-- A concise description of what the contribution brings, replace
"..." in the bullet list -->

- Currently the merlinite model generates a markdown table when asked to
generate an asciidoc table. This skill attempts to teach it how to
generate Asciidoc tables.
- I'm not sure about the path I've put the qna.yaml in here, please let
me know if it should be somewhere else.

I'll give several examples below of various questions asked before and
after, and will also include an image showing the before and after
rendered in an HTML page that was rendered from trying to interpret the
responses as Asciidoc.

**Try it out yourself!**
I've put the trained model from `lab train` onto Google Drive, so that
you can download it and ask your own questions, and not just rely on the
examples that I've provided below. You can find it here (note that it's
13.5GB):

https://drive.google.com/file/d/12JJhsZPWQxXZb-WZZUof_Cit2t09Y84n/view?usp=sharing


**Input given at the prompt**

<!-- What you entered, replace "..." -->
_See examples below the "Contribution checklist" section. I've put them
at the end because some of the Markdown features I've used are a bit
odd, and can cause effects to sections following them._


**Response from the original model**


<!-- What you received from the original model in response to your
input,
replace "..." -->
_See examples below the "Contribution checklist" section. I've put them
at the end because some of the Markdown features I've used are a bit
odd, and can cause effects to sections following them._


**Response from the fine-tuned model**


<!-- Generate a synthetic dataset based on your newly added seed data;
train the model
with the synthetic data and now re-test the model's response with the
same prompt.
Replace "..." with what you receive with the finetuned model. -->
_See examples below the "Contribution checklist" section. I've put them
at the end because some of the Markdown features I've used are a bit
odd, and can cause effects to sections following them._

**Contribution checklist**

<!-- Insert an x between the empty brackets: [ ] >> [x] -->

- [x] The contribution was tested with `ilab generate`
- [x] No errors or warnings were produced by `ilab generate`
- [x] All [commits are signed
off](https://github.com/instructlab/taxonomy/blob/main/CONTRIBUTING.md#legal)
(DCO)
- [x] The `qna.yaml` file contains at least 5 `seed_examples`
- [x] The `qna.yaml` file was [linted](https://yamllint.com) and
[prettified](https://onlineyamltools.com/prettify-yaml)
([yaml-validator](https://jsonformatter.org/yaml-validator) can do both)
- [x] An `attribution.txt` file in the same folder as the `qna.yaml`
file.


----

### Example 1
> Create an AsciiDoc table showing the IMDB top 5 movies, including the
year they were released, and their IMDB rating

<details>
  <summary>Response that was received</summary>
  <pre><code>
.. csv-table:: Top 5 IMDb Movies of All Time
   :header: Title, Year, IMDb Rating

   "The Godfather", 1972, 9.2
   "The Shawshank Redemption", 1994, 9.3
   "The Godfather: Part II", 1974, 9.0
   "Pulp Fiction", 1994, 8.9
   "The Dark Knight", 2008, 9.0
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the AsciiDoc code for the table:

.IMDB Top 5 Movies
[%header]
|===
| Movie         | Year   | Rating
| The Godfather | 1972   | 9.2
| The Shawshank Redemption | 1994   | 9.3
| The Dark Knight | 2008   | 9.0
| Pulp Fiction | 1994   | 8.9
| Forrest Gump | 1994   | 8.8
|===

The rendered HTML output will look like this:

IMDB Top 5 Movies
-----------------

| Movie         | Year   | Rating
| The Godfather | 1972   | 9.2
| The Shawshank Redemption | 1994   | 9.3
| The Dark Knight | 2008   | 9.0
| Pulp Fiction | 1994   | 8.9
| Forrest Gump | 1994   | 8.8
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/77d35479-3b82-41a0-9e0c-c7418f127bb1">
</details>

### Example 2
> Create an Asciidoc-formatted table with 4 rows and two columns, where
the first column is a random letter, and the second column is a random
number between 1 and 4.

<details>
  <summary>Response that was received</summary>
  <pre><code>

Certainly! I can help you create a randomized AsciiDoc table with the
specified structure. However, please note that I am an AI language model
and do not have the ability to generate truly random values. I will
provide you with a set of random values that you can use for the table.
Here's an example of how the table might look:

```
= Table: Random Letters and Numbers

| Random Letter | Random Number |
| --- | --- |
| A | 1 |
| B | 2 |
| C | 3 |
| D | 4 |
```

Feel free to replace the provided values with your own random letters
and numbers. If you need help generating random values, you can use an
online random number generator or a programming language to create the
values for the table.

</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the AsciiDoc code for the table:

.Table Example
[%header]
|===
| Column 1   | Column 2
| A          | 1
| B          | 2
| C          | 3
| D          | 4
|===

The rendered HTML output will look like this:

Table Example
-------------

| Column 1   | Column 2
| A          | 1
| B          | 2
| C          | 3
| D          | 4
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/f4352bb1-fa78-4169-9756-2ccff0d8db01">
</details>

### Example 3
> Convert the following Markdown table to AsciiDoc:
> 
>     | First name | Last name    | Age | Score |
>     | ---------- | ---------    | --- | ----- |
>     | Alice      | O'Wonderland | 20  | 53    |
>     | Bob        | Tables       | 10  | null  |
>     | Carol      | Basking      | 60  | 25    |
>     | Dave       | Letterbox    | 55  | 40    |


<details>
  <summary>Response that was received</summary>
  <pre><code>
Here's the AsciiDoc version of the table:

.. csv-table:: Table: Users' Information
   :header-rows: 1

   "First name", "Last name", "Age", "Score"
   "Alice", "O'Wonderland", "20", "53"
   "Bob", "Tables", "10", "null"
   "Carol", "Basking", "60", "25"
   "Dave", "Letterbox", "55", "40"

The table is created using the ``csv-table`` directive, which is
suitable for simple tables like this one.
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here is the equivalent AsciiDoc equivalent:

.Table: Students' Information
[%header]
|===
| First Name  | Last Name    | Age | Score
| ----------- | ------------ | --- | -----
| Alice       | O'Wonderland | 20  | 53
| Bob         | Tables       | 10  | null
| Carol       | Basking      | 60  | 25
| Dave        | Letterbox    | 55  | 40
|===

Note that the header row is formatted in brackets, and the rows that
follow it use the "|" delimiter to indicate the
column contents. The table is surrounded by "|===" lines to define the
table boundaries.
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/28d56989-76a7-42f6-9946-72b9e96fbdf1">
</details>

### Example 4
> Given the following csv file contents, how could it be represented as
an asciidoc table?
1,2,3,4
5,6,7,8
9,10,11,12


<details>
  <summary>Response that was received</summary>
  <pre><code>
To represent the given CSV file contents as an ASCIIDOC table, you can
use the `table()` directive along with the `row()` macro. Here's a
sample ASCIIDOC code that creates a table from the given CSV data:

=table
----
:name: table-csv
:source: csv-file.csv
:header: 1,2,3,4

=table
----
::
    :source: table-csv
::row()
1,2,3,4
::row()
5,6,7,8
::row()
9,10,11,12

In this example, the `table()` directive is used to define a table with
a given width for each column. The `:source` attribute is used to
specify the name of the CSV file that contains the data for the table.
The `:header` attribute is used to specify the header row of the CSV
file. The `row()` macro is then used to add rows to the table.

This will result in the following table:

| 1 | 2 | 3 | 4 |
| - | - | - | - |
| 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 |
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the asciidoc code for the table:

.Table: CSV Data
[%header]
|===
| Column 1 | Column 2 | Column 3 | Column 4
|----------|----------|----------|----------
| 1        | 2        | 3        | 4
| 5        | 6        | 7        | 8
| 9        | 10       | 11       | 12
|===

The asciidoc table is now represented using the .Table: CSV Data header,
and the rows and columns are defined using the |
row/column label | data coordinates format. The data coordinates
indicate the position of the data in the table.
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/b127929f-5705-4049-84d9-ee9ff7e01bf4">
</details>

### Example 5
> What is the syntax for creating an Asciidoc table?

<details>
  <summary>Response that was received</summary>
  <pre><code>
In Asciidoc, you can create a table using the `table` directive,
followed by rows and columns defined using pipelines (`|`) to separate
cells. Here's a simple example of an Ascidoc table:

```
=table | row1col1, row1col2, row1col3, row1col4, row1col5 | row2col1, row2col2, row2col3, row2col4, row2col5 | ...]
```

This creates a table with five headers and multiple rows. Each row
contains five cells separated by pipelines. If you want to create a
simple two-column table, you can use this syntax:

```
=table | row1col1, row1col2 | row2col1, row2col2 | ...]
```

In this example, `header1` and `header2` are the headers of the two
columns, and `row1col1`, `row1col2`, `row2col1`, and `row2col2` are the
cells of the two rows. You can replace these placeholders with your
desired content.

Keep in mind that Asciidoc tables support various formatting options,
such as aligning cells, merging cells, and using different table styles.
For more information on these features, refer to the official
Asciidoctor documentation or use a search engine to find additional
resources
on Asciidoctor tables.
</code></pre>
</details>

<details>
<summary>Response that is now received instead</summary>
<pre><code>
Here's the syntax for creating an Asciidoc table:

.. Table: Example Table - Asciidoc Syntax
:name: ascii-table-syntax
:widths: 20, 80

|===
| Column1 | Column2 |
|---------|---------|
| Value1  | Content |
| Value2  | Of the |
|         | second |
|         | column |
|---------|---------|
|===

The table has the following structure:

- The first line starts with the "|===" delimiter, followed by the table
name, widths, and widths parameters (if needed).
- Each subsequent line starts with the "|" delimiter, followed by the
column labels or values.
- The table ends with the "|===" delimiter.

The widths parameter is used to specify the width of each column in
terms of the number of characters. If not provided,
the widths will be automatically calculated based on the longest label
or value for each column.

Here's the AsciiDoc code for the example table:

.Table: AsciiDoc Table Syntax
[%header]
:name: ascii-table-syntax
:widths: 20, 80
|===
| Column1 | Column2 |
|---------|---------|
| Value1  | Content |
| Value2  | Of the |
|         | second  |
|         | column  |
|---------|---------|
|===

The rendered HTML output will display the table with the given structure
and content.
</code></pre>
</details>

<details>
<summary>Example screenshot of before and after as rendered HTML from an
Asciidoc processor on the responses</summary>
<img
src="https://github.com/instruct-lab/taxonomy/assets/442386/ff21bbcf-54b9-4eed-895e-714ef2eb4492">
</details>

---------

Signed-off-by: Gerard Ryan <git@grdryn.xyz>
Signed-off-by: BJ Hargrave <hargrave@us.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skill (Auto labeled)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants