Skip to content

Commit

Permalink
reverted update where all Dataset output examples to use python synta…
Browse files Browse the repository at this point in the history
…x highlighting, as this makes it harder to detect the difference between code and output in the docs, and is also less true to reality, as outputs are not syntax highlighted.
  • Loading branch information
djl11 committed Sep 19, 2024
1 parent 265d11c commit b081cc3
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions benchmarking/datasets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ then this is interpreted as the user message
import unify
datum = unify.Datum("This is a user message.")
```
```python
```
Datum(
prompt=Prompt(
messages=[{'content': 'This is a user message.', 'role': 'user'}],
Expand Down Expand Up @@ -66,7 +66,7 @@ Datum(
Again, this is better visualized after setting `unify.set_repr_mode("concise")`.
We will assume `"concise"` mode for the rest of the examples on this page:

```python
```
Datum(
prompt=Prompt(
messages=[{'content': 'This is a user message.', 'role': 'user'}]
Expand All @@ -85,7 +85,7 @@ datum = unify.Datum(
ref_answer="This is an answer."
)
```
```python
```
Datum(
prompt=Prompt(
messages=[{'content': 'This is a user message.', 'role': 'user'}]
Expand All @@ -112,7 +112,7 @@ When a list of strings is passed, these strings are also interpreted as *user me
but as explained above, the underlying dataset will contains `Datum` instances,
which themselves contain `Prompt` instances:

```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -153,7 +153,7 @@ dataset = unify.Dataset([
),
])
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -208,7 +208,7 @@ dataset = unify.Dataset([
),
])
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -243,7 +243,7 @@ interpreted as single-item datasets:
import unify
dataset = unify.Dataset("First user message.")
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -296,7 +296,7 @@ dataset = unify.Dataset([
])
print(dataset[1:-1])
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -344,7 +344,7 @@ dataset2 = unify.Dataset([
])
print(dataset1 + dataset2)
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -385,7 +385,7 @@ dataset2 = unify.Dataset([
])
print(dataset1 + dataset2)
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -434,7 +434,7 @@ dataset += "Second user message."
dataset += unify.Prompt(messages=[{'content': 'Third user message.', 'role': 'user'}])
dataset += ["Fourth user message.", "Fifth user message."]
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -473,7 +473,7 @@ The ordering of the operation also does not matter, by virtue of `__radd__` and
import unify
"User message" + unify.Dataset("Another user message.")
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -502,7 +502,7 @@ dataset = "First user message." \
+ unify.Datum("Third user message")
print(dataset)
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -542,7 +542,7 @@ dataset2 = unify.Dataset([
])
print(dataset1 - dataset2)
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -592,7 +592,7 @@ dataset -= "First user message"
dataset = dataset - unify.Prompt("Second user message.")
print(dataset)
```
```python
```
Dataset(
[
Datum(
Expand Down Expand Up @@ -697,7 +697,7 @@ You can directly download a dataset from your account as follows:
import unify
dataset = unify.Dataset.from_upstream("my_dataset")
```
```python
```
Dataset(
[
Datum(
Expand Down

0 comments on commit b081cc3

Please sign in to comment.