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

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

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Nov 1, 2024

Summary by CodeRabbit

  • New Features
    • Introduced new endpoints for creating, updating, and deleting tracer sessions, enhancing session management.
    • Added functionality to query and filter tracer sessions, including fetching metadata.
    • Enabled the creation, updating, and deletion of datasets, with support for CSV uploads and dataset cloning.
    • Implemented new endpoints for managing examples, including bulk uploads and data validation.

Copy link

coderabbitai bot commented Nov 1, 2024

Walkthrough

The changes introduce new API endpoints and methods for managing tracer sessions, datasets, and examples within the LangSmith platform. Key additions include functionalities for creating, updating, and deleting tracer sessions and datasets, as well as querying and filtering tracer sessions. Enhanced capabilities also allow for bulk uploads and validation of examples, significantly expanding the API's features related to these core components.

Changes

File Path Change Summary
src/libs/LangSmith/openapi.yaml Added new API endpoints for creating, updating, deleting tracer sessions, datasets, and examples.
src/libs/LangSmith/TracerSession.py Added methods for creating, updating, and reading tracer sessions.
src/libs/LangSmith/Dataset.py Added methods for creating and updating datasets.
src/libs/LangSmith/Example.py Added methods for creating and updating examples.

Possibly related PRs

Suggested reviewers

  • github-actions

🐇 In the meadow, I hop with glee,
New endpoints sprout, as bright as can be!
Tracer sessions, datasets, all in a row,
With examples to share, watch our features grow!
Hooray for the changes, let’s celebrate,
In the world of LangSmith, we innovate! 🌼


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 November 1, 2024 15:20
@github-actions github-actions bot merged commit 953b911 into main Nov 1, 2024
3 checks passed
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add API endpoints for managing tracer sessions, datasets, and examples Nov 1, 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: 1

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

15778-15784: Well-structured message type definitions with comprehensive coverage.

The schema correctly handles polymorphic message types and includes both regular and streaming variants.

Consider grouping the regular messages and chunk messages separately for better readability:

           items:
             oneOf:
-              - $ref: '#/components/schemas/AIMessage'
-              - $ref: '#/components/schemas/HumanMessage'
-              - $ref: '#/components/schemas/ChatMessage'
-              - $ref: '#/components/schemas/SystemMessage'
-              - $ref: '#/components/schemas/FunctionMessage'
-              - $ref: '#/components/schemas/ToolMessage'
-              - $ref: '#/components/schemas/AIMessageChunk'
-              - $ref: '#/components/schemas/HumanMessageChunk'
-              - $ref: '#/components/schemas/ChatMessageChunk'
-              - $ref: '#/components/schemas/SystemMessageChunk'
+              # Regular messages
+              - $ref: '#/components/schemas/AIMessage'
+              - $ref: '#/components/schemas/HumanMessage'
+              - $ref: '#/components/schemas/ChatMessage'
+              - $ref: '#/components/schemas/SystemMessage'
+              - $ref: '#/components/schemas/FunctionMessage'
+              - $ref: '#/components/schemas/ToolMessage'
+              # Streaming chunks
+              - $ref: '#/components/schemas/AIMessageChunk'
+              - $ref: '#/components/schemas/HumanMessageChunk'
+              - $ref: '#/components/schemas/ChatMessageChunk'
+              - $ref: '#/components/schemas/SystemMessageChunk'
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d9d8a75 and 4e4128f.

⛔ Files ignored due to path filters (48)
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageChunkInputType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageChunkInputTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageChunkOutputType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageChunkOutputTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageChunkType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageChunkTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.MessagesItem.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.MessagesItem2.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasResponseArtifactLength.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasResponseArtifactLengthNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasResponseMessageDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasResponseMessageDiscriminatorTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasResponseReadingLevel.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasResponseReadingLevelNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonSerializerContext.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.IPromptsClient.Canvas.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessage.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageAdditionalKwargs.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunk.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkAdditionalKwargs.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkContentVariant2Item.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkInputAdditionalKwargs.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkInputContentVariant2Item.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkInputResponseMetadata.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkOutput.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkOutputContentVariant2Item.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkOutputResponseMetadata.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkOutputType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkResponseMetadata.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageContentVariant2Item.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageOutput.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageOutputContentVariant2Item.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageOutputType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageResponseMetadata.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.CanvasApiV1PromptsCanvasPostResponse.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.MessagesItem.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.MessagesItem2.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasResponse.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasResponseArtifactLength.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasResponseMessageDiscriminator.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasResponseMessageDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasResponseReadingLevel.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.PromptsClient.Canvas.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/LangSmith/openapi.yaml (4 hunks)
🔇 Additional comments (2)
src/libs/LangSmith/openapi.yaml (2)

10349-10351: Verify AIMessage schema completeness.

The schema definition appears to be missing property definitions for the required 'content' field and potentially other important fields that an AI message should contain.

Let's check the complete schema definition:

✅ Verification successful

AIMessage schema is properly defined

The schema is complete and well-structured with:

  • Required 'content' field properly defined with support for both string and array types
  • Additional fields for 'additional_kwargs' and 'response_metadata'
  • Type field included
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the complete AIMessage schema definition
# Expected: Should find property definitions including 'content' and other message fields

rg -A 20 "AIMessage:\n.*title: AIMessage" src/libs/LangSmith/openapi.yaml

Length of output: 267


Script:

#!/bin/bash
# Description: Verify the complete AIMessage schema definition using multiline mode
# Expected: Should find property definitions including 'content' and other message fields

rg -U -A 20 "AIMessage:\n\s+title: AIMessage" src/libs/LangSmith/openapi.yaml

Length of output: 594


10401-10403: Verify AIMessageChunk relationship with AIMessage.

Since AIMessageChunk appears to be a streaming variant of AIMessage, consider whether they should share common schema definitions to ensure consistency.

Let's check the relationship between these schemas:

✅ Verification successful

AIMessageChunk correctly mirrors AIMessage schema structure

The verification shows that AIMessageChunk and AIMessage share identical schema structure with the same required fields and property definitions:

  • Both require 'content' field
  • Both have identical property definitions for content, additional_kwargs, response_metadata, and type
  • Content field in both schemas supports either string or array of strings/objects

This consistency ensures proper handling of both complete messages and streaming chunks.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Compare AIMessage and AIMessageChunk schemas
# Expected: Should find similar structure with potential differences for streaming

rg -B 5 -A 20 "AIMessageChunk:\n.*title: AIMessageChunk" src/libs/LangSmith/openapi.yaml

Length of output: 282


Script:

#!/bin/bash
# Description: Compare AIMessage and AIMessageChunk schemas using multiline mode
# Expected: Should find similar structure with potential differences for streaming

rg -U -B 5 -A 20 'AIMessageChunk:.*\n.*title: AIMessageChunk' src/libs/LangSmith/openapi.yaml

# Also search for AIMessage schema for comparison
rg -U -B 5 -A 20 'AIMessage:.*\n.*title: AIMessage[^C]' src/libs/LangSmith/openapi.yaml

Length of output: 1794

@@ -7481,8 +7481,7 @@ paths:
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PlaygroundPromptCanvasResponse'
schema: { }
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Empty response schema should be defined explicitly.

An empty schema provides no validation or documentation value. This could lead to inconsistent API responses and poor developer experience.

Consider defining the expected response structure explicitly:

-              schema: { }
+              schema:
+                type: object
+                description: "Successful response payload"
+                properties: {}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
schema: { }
schema:
type: object
description: "Successful response payload"
properties: {}

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