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 binary examples for Textcat task in spacy-llm #13051

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions website/docs/api/large-language-models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,22 @@ prompt.
The formatting of few-shot examples is the same as those for the
[v1](#textcat-v1) implementation.

If you want to perform few-shot learning with a binary classifier, you can
provide positive and negative examples - e. g.:

```json
[
{
"text": "You won the lottery! Wire a fee of 200$ to be able to withdraw your winnings.",
"answer": "Spam"
},
{
"text": "Your order #123456789 has arrived",
"answer": "NotSpam"
}
]
```

rmitsch marked this conversation as resolved.
Show resolved Hide resolved
#### spacy.TextCat.v2 {id="textcat-v2"}

V2 includes all v1 functionality, with an improved prompt template.
Expand Down Expand Up @@ -702,6 +718,22 @@ V2 includes all v1 functionality, with an improved prompt template.
The formatting of few-shot examples is the same as those for the
[v1](#textcat-v1) implementation.

If you want to perform few-shot learning with a binary classifier, you can
provide positive and negative examples - e. g.:

```json
[
{
"text": "You won the lottery! Wire a fee of 200$ to be able to withdraw your winnings.",
"answer": "Spam"
},
{
"text": "Your order #123456789 has arrived",
"answer": "NotSpam"
}
]
```

#### spacy.TextCat.v1 {id="textcat-v1"}

Version 1 of the built-in TextCat task supports both zero-shot and few-shot
Expand Down Expand Up @@ -752,6 +784,22 @@ supports `.yml`, `.yaml`, `.json` and `.jsonl`.
path = "textcat_examples.json"
```

If you want to perform few-shot learning with a binary classifier, you can
provide positive and negative examples - e. g.:

```json
[
{
"text": "You won the lottery! Wire a fee of 200$ to be able to withdraw your winnings.",
"answer": "Spam"
},
{
"text": "Your order #123456789 has arrived",
"answer": "NotSpam"
}
]
```

rmitsch marked this conversation as resolved.
Show resolved Hide resolved
### REL {id="rel"}

The REL task extracts relations between named entities.
Expand Down