create_feedback_config(
self,
feedback_key: str,
*,
feedback_config: ls_schemas.FeedbackConfig,
is_lower_score_better: Optional| Name | Type | Description |
|---|---|---|
feedback_key* | str | The feedback key to configure. |
feedback_config* | FeedbackConfig | The configuration defining type, bounds, and categories. |
is_lower_score_better | Optional[bool] | Default: NoneWhether a lower score is considered better. When omitted, a key that already has configs keeps its direction, and a new key defaults to False. |
is_enforced | bool | Default: False |
Create a feedback configuration.
Defines how feedback with a given key should be interpreted. If an identical configuration already exists for the key, it is returned unchanged. If a different configuration already exists for the key, the result depends on the workspace: with enforced feedback configs on, the new configuration is added next to the existing ones (unless the key has an enforced configuration); otherwise an HTTP 400 "Feedback config already exists" is raised.
Example:
.. code-block:: python
from langsmith import Client
client = Client() config = client.create_feedback_config( feedback_key="user-rating", feedback_config={ "type": "continuous", "min": 0.0, "max": 5.0, }, )
tags = client.create_feedback_config( feedback_key="topics", feedback_config={ "type": "categorical", "categories": [ {"value": 0, "label": "billing"}, {"value": 1, "label": "shipping"}, ], "allows_multiple_categories": True, }, )
Create the key's enforced configuration, which sets the rules for the whole workspace. Requires the feedback-configs:manage-enforced permission, which workspace admins have. Fails if the key already has an enforced configuration. Defaults to False.