yocto-gl icon indicating copy to clipboard operation
yocto-gl copied to clipboard

OpenAI flavor autologging

Open gabrielfu opened this issue 10 months ago • 5 comments

Related Issues/PRs

#xxx

What changes are proposed in this pull request?

Enable autologging support for OpenAI flavor

Supported functions:

  • openai.chat.completions.create
  • openai.completions.create
  • openai.embeddings.create

Logged items:

  • model: runs:/<run_id>/model, models:/openai_model/1
  • within each session, each inference input & output will be logged in
    • artifacts-<session_id>-<inference_id>/input.json
    • artifacts-<session_id>-<inference_id>/output.json
  • each task will be logged as a separate run

Supports openai.OpenAI()

Supports streaming output

Does not support async client openai.AsyncOpenAI()

Does not support OpenAI < 1.0

How is this PR tested?

  • [ ] Existing unit/integration tests
  • [X] New unit/integration tests
  • [ ] Manual tests

Does this PR require documentation update?

  • [ ] No. You can skip the rest of this section.
  • [X] Yes. I've updated:
    • [X] Examples
    • [X] API references
    • [X] Instructions

Release Notes

Is this a user-facing change?

  • [ ] No. You can skip the rest of this section.
  • [X] Yes. Give a description of this change to be included in the release notes for MLflow users.

Enable autologging support for OpenAI flavor for openai >= 1.0

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • [ ] area/artifacts: Artifact stores and artifact logging
  • [ ] area/build: Build and test infrastructure for MLflow
  • [ ] area/deployments: MLflow Deployments client APIs, server, and third-party Deployments integrations
  • [ ] area/docs: MLflow documentation pages
  • [ ] area/examples: Example code
  • [ ] area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • [X] area/models: MLmodel format, model serialization/deserialization, flavors
  • [ ] area/recipes: Recipes, Recipe APIs, Recipe configs, Recipe Templates
  • [ ] area/projects: MLproject format, project running backends
  • [ ] area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • [ ] area/server-infra: MLflow Tracking server backend
  • [ ] area/tracking: Tracking Service, tracking client APIs, autologging

Interface

  • [ ] area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • [ ] area/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
  • [ ] area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • [ ] area/windows: Windows support

Language

  • [ ] language/r: R APIs and clients
  • [ ] language/java: Java APIs and clients
  • [ ] language/new: Proposals for new client languages

Integrations

  • [ ] integrations/azure: Azure and Azure ML integrations
  • [ ] integrations/sagemaker: SageMaker integrations
  • [ ] integrations/databricks: Databricks integrations

How should the PR be classified in the release notes? Choose one:

  • [ ] rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • [ ] rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • [X] rn/feature - A new user-facing feature worth mentioning in the release notes
  • [ ] rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • [ ] rn/documentation - A user-facing documentation change worth mentioning in the release notes

Should this PR be included in the next patch release?

Yes should be selected for bug fixes, documentation updates, and other small changes. No should be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.

What is a minor/patch release?
  • Minor release: a release that increments the second part of the version number (e.g., 1.2.0 -> 1.3.0). Bug fixes, doc updates and new features usually go into minor releases.
  • Patch release: a release that increments the third part of the version number (e.g., 1.2.0 -> 1.2.1). Bug fixes and doc updates usually go into patch releases.
  • [ ] Yes (this PR will be cherry-picked and included in the next patch release)
  • [X] No (this PR will be included in the next minor release)

gabrielfu avatar Apr 18 '24 06:04 gabrielfu

Documentation preview for 7978240290bccf7f9dccd7289bc10fd9a663f7b4 will be available when this CircleCI job completes successfully.

More info
  • Ignore this comment if this PR does not change the documentation.
  • It takes a few minutes for the preview to be available.
  • The preview is updated when a new commit is pushed to this PR.
  • This comment was created by https://github.com/mlflow/mlflow/actions/runs/9167768831.

github-actions[bot] avatar Apr 18 '24 06:04 github-actions[bot]

@harupy please feel free to take a look and comment if you have time! :)

gabrielfu avatar Apr 18 '24 06:04 gabrielfu

@gabrielfu Thanks for the PR! Looking :)

harupy avatar Apr 18 '24 10:04 harupy

@gabrielfu

We're currently working on a new feature (tracing) on the tracing branch. I'm trying to figure out what's the best to integrate it in openai autologging. I'll keep you posted about this.

harupy avatar Apr 19 '24 08:04 harupy

Looks good to me! Can we merge this after we release MLflow 2.13.0 (target: May 20th)? This allows us to adjust the implementation for tracing before 2.14.0 :)

Sure! :)

gabrielfu avatar May 13 '24 06:05 gabrielfu