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

[BUG-python/deployment] ranking question's results are not saved correctly. #5712

Open
yichuan5 opened this issue Nov 25, 2024 · 0 comments
Open

Comments

@yichuan5
Copy link

yichuan5 commented Nov 25, 2024

Describe the bug
After the users submit the ranking through UI, the ranking order is NOT saved correctly. All ranking orders are saved as ["1","2","3"], regardless of actual user input.

Stacktrace and Code to create the bug

import pandas as pd
import argilla as rg

client = rg.Argilla(
    api_url="http://localhost:6900",
    api_key="argilla.apikey",
)

# Define settings for the Argilla dataset
settings = rg.Settings(
    guidelines="Please read the prompt carefully and choose the best response(s).",
    fields=[
        rg.TextField(name="prompt", required=True, use_markdown=True),
        rg.TextField(name="Golden Answer", required=True, use_markdown=True),
        rg.TextField(name="Response 1", required=True, use_markdown=True),
        rg.TextField(name="Response 2", required=True, use_markdown=True),
        rg.TextField(name="Response 3", required=True, use_markdown=True),
    ],
    questions=[
        rg.RankingQuestion (
            name="x",
            values=["1","2","3"],
            title="?",
            description="x",
            required=True,
        )
    ],
    allow_extra_metadata=True,
    distribution=rg.TaskDistribution(min_submitted=1),
)

dataset_name = "test"
dataset = rg.Dataset(
    name=dataset_name,
    workspace="default",
    settings=settings,
)

dataset.create()

def load_data_to_argilla(df):
    records = []
    for _, row in df.head(1).iterrows():
        prompt = row["Question"]
        golden = row["Golden Answer"]
        xxx = row["xxx"]
        yyy = row["yyy"]
        zzz = row["zzz"]
        response_1, response_2, response_3=  xxx, yyy, zzz

        record = rg.Record(
            fields={
                "prompt": prompt,
                "Golden Answer" : golden,
                "Response 1": response_1,
                "Response 2": response_2,
                "Response 3": response_3,
            }
        )
        records.append(record)
    return records


df = pd.read_excel("test.xlsx")

# Log records to Argilla
records = load_data_to_argilla(df)
dataset.records.log(records)

Environment:

  • Argilla Version [2.4.0]:
  • Docker Image argilla/argilla-server :[2.4.1]:
  • elasticsearch : 8.12.2
@yichuan5 yichuan5 changed the title [BUG-python/deployment] [BUG-python/deployment] ranking question result are not saved correctly. Nov 25, 2024
@yichuan5 yichuan5 changed the title [BUG-python/deployment] ranking question result are not saved correctly. [BUG-python/deployment] ranking question's results are not saved correctly. Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant