Skip to content

Commit

Permalink
Merge branch 'feat/rename-argilla-2-argilla-v1' into feat/argilla/ren…
Browse files Browse the repository at this point in the history
…ame-argilla-to-argilla-v1
  • Loading branch information
frascuchon committed Jun 7, 2024
2 parents c38dd87 + 4e570d8 commit f25da20
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/argilla-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
branches:
- "develop"
- "main"
- "feat/**"

pull_request:
paths:
Expand Down Expand Up @@ -55,7 +56,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Setup PDM
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/argilla-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ on:
branches:
- main
- develop
- "feat/**"
- releases/**

pull_request:
paths:
- argilla-server/**
Expand Down
5 changes: 3 additions & 2 deletions argilla-sdk/docs/guides/how_to_guides/record.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ You can add records to a dataset in two different ways: either by using a dictio

dataset.records.log(records)
```

1. This is an illustration of a definition. In a real world scenario, you would iterate over a data structure and create `Record` objects for each iteration.

=== "From a generic data structure"
Expand All @@ -99,7 +100,7 @@ You can add records to a dataset in two different ways: either by using a dictio
{
"question": "What is the boiling point of water?",
"answer": "100 degrees Celsius",
}, # (2)
}, # (1)
]
dataset.records.log(data)

Expand All @@ -114,7 +115,7 @@ You can add records to a dataset in two different ways: either by using a dictio
"response": "100 degrees Celsius",
},
]
dataset.records.log(data, mapping={"query": "question", "response": "answer"}) # (3)
dataset.records.log(data, mapping={"query": "question", "response": "answer"}) # (2)
```

1. The data structure's keys must match the fields or questions in the Argilla dataset. In this case, there are fields named `question` and `answer`.
Expand Down
4 changes: 3 additions & 1 deletion argilla-sdk/src/argilla_sdk/_helpers/_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"critical": logging.CRITICAL,
}

logger = logging.getLogger(name="argilla.sdk")


def log_message(message: str, level: str = "info") -> None:
"""Log a message at the specified level.
Expand All @@ -31,7 +33,7 @@ def log_message(message: str, level: str = "info") -> None:
level (str): The log level to use. Defaults to "info".
"""
level_int = LOG_LEVEL_MAP.get(level, logging.INFO)
logging.log(level=level_int, msg=message)
logger.log(level=level_int, msg=message)


class LoggingMixin:
Expand Down
5 changes: 4 additions & 1 deletion argilla-sdk/src/argilla_sdk/records/_io/_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Dict, List, Union, Optional, Type
from typing import Dict, List, Union, Optional, Type, TYPE_CHECKING

from argilla_sdk.records._io._generic import GenericIO

if TYPE_CHECKING:
from argilla_sdk.records import Record


def _resolve_hf_datasets_type() -> Optional[Type]:
"""This function resolves the `datasets.Dataset` type safely in case the datasets package is not installed.
Expand Down
11 changes: 7 additions & 4 deletions argilla-sdk/src/argilla_sdk/settings/_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import List, Optional, Union, Dict
from typing import List, Literal, Optional, Union, Dict

from argilla_sdk._models._settings._questions import (
LabelQuestionModel,
Expand Down Expand Up @@ -78,7 +78,7 @@ class LabelQuestion(QuestionPropertyBase):
def __init__(
self,
name: str,
labels: List[str],
labels: Union[List[str], Dict[str, str]],
title: Optional[str] = None,
description: Optional[str] = None,
required: bool = True,
Expand All @@ -90,7 +90,8 @@ def __init__(
Parameters:
name: str: The name of the question to be used as a reference.
labels: List[str]: The list of available labels for the question.
labels: Union[List[str], Dict[str, str]]: The list of available labels for the question,
or a dictionary of key-value pairs where the key is the label and the value is the label text in the UI.
title: Optional[str]: The title of the question to be shown in the UI.
description: Optional[str]: The description of the question to be shown in the UI.
required: bool: If the question is required for a record to be valid.
Expand Down Expand Up @@ -150,7 +151,7 @@ def __init__(
name: str,
labels: List[str],
visible_labels: Optional[int] = None,
labels_order: str = "natural",
labels_order: Literal["natural", "suggestion"] = "natural",
title: Optional[str] = None,
description: Optional[str] = None,
required: bool = True,
Expand All @@ -162,6 +163,8 @@ def __init__(
Parameters:
name: str: The name of the question to be used as a reference.
labels: List[str]: The list of available labels for the question.
labels_order: Literal["natural", "suggestion"]: The order of the labels in the UI. \
Can be either "natural" or "suggestion". Default is "natural".
title: Optional[str]: The title of the question to be shown in the UI.
description: Optional[str]: The description of the question to be shown in the UI.
required: bool: If the question is required for a record to be valid.
Expand Down
1 change: 0 additions & 1 deletion argilla/environment_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@ dependencies:
- nltk < 4.0.0
- httpx~=0.26.0
# install Argilla packages in editable mode
- -e ../argilla-server[postgresql]
- -e .[listeners]

0 comments on commit f25da20

Please sign in to comment.