Skip to content

Quality scorer default structured output #873

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

Merged
merged 16 commits into from
Aug 9, 2024

Conversation

plaguss
Copy link
Contributor

@plaguss plaguss commented Aug 9, 2024

Description

Adds a default JSON schema to generate the scores in a structured manner.

from distilabel.steps.tasks import QualityScorer
from distilabel.llms.huggingface import InferenceEndpointsLLM

scorer = QualityScorer(
    llm=InferenceEndpointsLLM(
        model_id="meta-llama/Meta-Llama-3.1-70B-Instruct",
    ),
    use_default_structured_output=True
)

scorer.load()

result = next(
    scorer.process(
        [
            {
                "instruction": "instruction",
                "responses": ["good response", "weird response", "bad response"]
            }
        ]
    )
)

>>> result
[{'instruction': 'instruction',
  'responses': ['good response', 'weird response', 'bad response'],
  'scores': [1, 2, 3],
  'distilabel_metadata': {'raw_output_quality_scorer_0': '{  "scores": [1, 2, 3] }'},
  'model_name': 'meta-llama/Meta-Llama-3.1-70B-Instruct'}]

Closes #872, must be merged after #870

@plaguss plaguss added the enhancement New feature or request label Aug 9, 2024
@plaguss plaguss added this to the 1.4.0 milestone Aug 9, 2024
@plaguss plaguss requested a review from gabrielmbmb August 9, 2024 07:28
Copy link

github-actions bot commented Aug 9, 2024

Documentation for this PR has been built. You can view it at: https://distilabel.argilla.io/pr-873/

@plaguss plaguss linked an issue Aug 9, 2024 that may be closed by this pull request
@plaguss plaguss self-assigned this Aug 9, 2024
@plaguss plaguss merged commit aa616a1 into develop Aug 9, 2024
0 of 5 checks passed
@plaguss plaguss deleted the quality-scorer-default-structured-output branch August 9, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] QualityScorer predefined structured output
1 participant