Skip to content

feat:Add new API endpoints for managing tracer sessions, datasets, and examples#116

Merged
github-actions[bot] merged 1 commit intomainfrom
bot/update-openapi_202410310135
Oct 31, 2024
Merged

feat:Add new API endpoints for managing tracer sessions, datasets, and examples#116
github-actions[bot] merged 1 commit intomainfrom
bot/update-openapi_202410310135

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Oct 31, 2024

Summary by CodeRabbit

  • New Features
    • Introduced new API endpoints for creating, updating, and deleting tracer sessions.
    • Added functionality to read, create, and update datasets, including CSV uploads and format downloads.
    • Enabled bulk uploads for examples and introduced validation for examples before creation.

These enhancements improve the management capabilities for tracer sessions, datasets, and examples within the LangSmith platform.

@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2024

Walkthrough

The pull request introduces multiple new API endpoints in the LangSmith platform, enhancing the management of tracer sessions, datasets, and examples. Key additions include endpoints for creating, updating, and deleting tracer sessions, as well as functionalities for managing datasets and examples, including bulk uploads and validation. The method signatures for existing endpoints have also been updated to accommodate new parameters.

Changes

File Path Change Summary
src/libs/LangSmith/openapi.yaml - Added methods for creating, updating, and deleting tracer sessions.
- Added methods for reading, creating, and updating datasets, including CSV uploads and downloads.
- Added methods for creating, updating, and deleting examples, including bulk uploads.
- Added a method for validating examples before creation.
- Updated method signature for reading tracer sessions to include new parameters.

Possibly related PRs

Suggested reviewers

  • github-actions

🐰 In the meadow, changes bloom,
New endpoints chase away the gloom.
With sessions, datasets, examples in tow,
LangSmith's magic continues to grow!
Hops and skips, a joyful cheer,
For every update brings us near! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot enabled auto-merge October 31, 2024 01:36
@github-actions github-actions bot merged commit 2d1eca3 into main Oct 31, 2024
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add new API endpoints for managing tracer sessions, datasets, and examples Oct 31, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
src/libs/LangSmith/openapi.yaml (1)

2379-2408: Consider adding rate limiting and content validation.

The validation endpoint is well-structured with proper security and error handling. However, consider these improvements:

  1. Add rate limiting headers to prevent abuse:
      responses:
        '200':
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
            X-RateLimit-Remaining:
              schema:
                type: integer
  1. Add explicit content-type validation:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExampleCreate'
        required: true
        x-content-type-validation: true
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0fa8213 and 4dc20d5.

⛔ Files ignored due to path filters (11)
  • src/libs/LangSmith/Generated/JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.ExamplesClient.UpdateExample.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.ExamplesClient.ValidateExample.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.IExamplesClient.UpdateExample.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.IExamplesClient.ValidateExample.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.ExampleUpdate.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.ExampleUpdateWithID.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.ExampleValidationResult.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.ExampleValidationResultInputs.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.ExampleValidationResultMetadata.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.ExampleValidationResultOutputs.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/LangSmith/openapi.yaml (3 hunks)

Comment on lines +13377 to +13430
ExampleValidationResult:
title: ExampleValidationResult
type: object
properties:
dataset_id:
title: Dataset Id
type: string
format: uuid
nullable: true
inputs:
title: Inputs
type: object
nullable: true
outputs:
title: Outputs
type: object
nullable: true
created_at:
title: Created At
type: string
format: date-time
nullable: true
metadata:
title: Metadata
type: object
nullable: true
source_run_id:
title: Source Run Id
type: string
format: uuid
nullable: true
split:
title: Split
anyOf:
- type: array
items:
type: string
- type: string
default: base
nullable: true
id:
title: Id
type: string
format: uuid
nullable: true
use_source_run_io:
title: Use Source Run Io
type: boolean
default: false
overwrite:
title: Overwrite
type: boolean
default: false
description: 'Validation result for Example, combining fields from Create/Base/Update schemas.'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider schema improvements for better type safety.

The ExampleValidationResult schema is comprehensive but could benefit from these improvements:

  1. Add constraints to the metadata object:
        metadata:
          title: Metadata
          type: object
          additionalProperties: true
          maxProperties: 50  # Prevent excessive metadata
          propertyNames:
            pattern: '^[a-zA-Z0-9_-]+$'  # Restrict key names
  1. Simplify the split field definition:
        split:
          title: Split
          type: string
          default: base
          nullable: true
          enum: [base, train, test, validation]  # If these are the expected values

Comment on lines +13332 to +13335
overwrite:
title: Overwrite
type: boolean
default: false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Overwrite parameter needs documentation and description

The overwrite field appears in multiple schemas (Example update schemas) but lacks a proper description of its behavior. While the default false value suggests backward compatibility:

  • The field is missing a description property in the OpenAPI spec to explain its purpose and effects
  • No documentation found explaining the overwrite behavior to API consumers
  • The field appears to be part of example update operations, with the API tracking number of updated examples via X-Updated-Examples-Count header
🔗 Analysis chain

Verify overwrite behavior implications.

The new overwrite field looks well-defined, but please ensure:

  1. The default false value maintains backward compatibility
  2. The overwrite behavior is properly documented in the API docs
  3. Existing clients are prepared for this change
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if overwrite behavior is documented
rg -l "overwrite.*example" --type md

# Look for existing example update implementations
ast-grep --pattern 'update.*example.*overwrite'

Length of output: 88


Script:

#!/bin/bash
# Search for any documentation about overwrite in markdown files with broader pattern
rg -i "overwrite" --type md -C 2

# Look for example update related code with broader patterns
rg "example.*update" -C 3

# Check for any existing overwrite parameters in the OpenAPI spec
rg "overwrite" --type yaml -C 2

Length of output: 1399


Script:

#!/bin/bash
# Get more context around the example update API endpoint
rg -B 10 -A 10 "X-Updated-Examples-Count" src/libs/LangSmith/openapi.yaml

# Look for any description or documentation of the overwrite parameter
rg -B 5 -A 5 "title: Overwrite" src/libs/LangSmith/openapi.yaml

Length of output: 1679

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.

1 participant