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

[OPIK-573] Implement get_experiment_by_[name, id] and implement Experiment.get_items() #868

Merged

Conversation

alexkuzmik
Copy link
Collaborator

@alexkuzmik alexkuzmik commented Dec 11, 2024

Details

Access to existing experiment

It is now possible to get Experiment instance for an experiment that already exists.

client = Opik()
experiment = client.get_experiment_by_name("my-experiment-123")
# or 
experiment = client.get_experiment_by_id("...")

Experiment methods updates

  1. A signature to experiment.insert has been changed to:
def insert(
    self,
    experiment_items_references: List[ExperimentItemReferences],
)

where ExperimentItemReferences is a dataclass

@dataclasses.dataclass
class ExperimentItemReferences:
    dataset_item_id: str
    trace_id: str

It emphasizes that experiment items are essentialy just dataset items and traces linked together, and it is not possible to create an experiment item by manually specifying its content.

  1. A new method was added - experiment.get_items(). It returns a list of ExperimentItemContent objects.
@dataclasses.dataclass
class ExperimentItemContent:
    id: str
    dataset_item_id: str
    trace_id: str
    dataset_item_data: Optional[Dict[str, Any]]
    evaluation_task_output: Optional[Dict[str, Any]]
    feedback_scores: List[FeedbackScoreDict]

New names in the opik namespace

ExperimentItemReferences and ExperimentItemContent were added to opik.__all__ list.

Issues

Resolves (#851)

Testing

Unit tests and e2e tests were updated.

Documentation

Docstrings added.

@alexkuzmik alexkuzmik self-assigned this Dec 11, 2024
@alexkuzmik alexkuzmik requested a review from a team as a code owner December 11, 2024 16:29
@alexkuzmik alexkuzmik marked this pull request as draft December 11, 2024 16:29
@alexkuzmik alexkuzmik changed the title [OPIK-573] Implement get_experiment_by_name and implement Experiment.get_items() [OPIK-573] Implement get_experiment_by_[name, id] and implement Experiment.get_items() Dec 12, 2024
@alexkuzmik alexkuzmik marked this pull request as ready for review December 12, 2024 11:46
japdubengsub
japdubengsub previously approved these changes Dec 12, 2024
@jverre
Copy link
Collaborator

jverre commented Dec 13, 2024

Hi @alexkuzmik

Can we update the definition for ExperimentItemContent to align more with the UI:

  • input -> dataset_item_data
  • output -> evaluation_task_output

@japdubengsub japdubengsub self-requested a review December 13, 2024 12:41
@alexkuzmik alexkuzmik merged commit 231ed88 into main Dec 13, 2024
23 checks passed
@alexkuzmik alexkuzmik deleted the OPIK-573-fr-get-evaluation-outputs-no-client-get-experiment branch December 13, 2024 12:59
Lothiraldan added a commit that referenced this pull request Dec 17, 2024
Lothiraldan added a commit that referenced this pull request Dec 17, 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

Successfully merging this pull request may close these issues.

3 participants