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:Update openapi.yaml with new endpoint and modified JSON schemas #114

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Oct 29, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new API endpoint to retrieve JSON schema for tool definitions.
    • Added schemas for playground prompt canvas functionality.
  • Changes

    • Updated existing schemas related to AI messages for improved representation.
    • Removed outdated schemas to streamline API structure.

Copy link

coderabbitai bot commented Oct 29, 2024

Walkthrough

The changes in this pull request primarily involve modifications to the openapi.yaml file for the LangSmith application. A new endpoint for retrieving tool definition JSON schemas has been added, while existing schemas have been updated and replaced. Specifically, the PlayGroundGraph schema has been renamed and modified, and several schemas related to AI messages have been removed and substituted with new variants.

Changes

File Change Summary
src/libs/LangSmith/openapi.yaml - Added endpoint /api/v1/public/schemas/{version}/tooldef.json for tool definition schema.
- Modified PlayGroundGraph schema to PlaygroundPromptCanvasPayload and PlaygroundPromptCanvasResponse.
- Removed AIMessage and AIMessageChunk schemas; added AIMessage-Input, AIMessage-Output, AIMessageChunk-Input, and AIMessageChunk-Output schemas.

Possibly related PRs

Suggested reviewers

  • github-actions

Poem

In the land of code where rabbits hop,
New schemas bloom, and old ones stop.
With endpoints fresh and changes bright,
We dance in joy, oh what a sight!
From tooldefs to prompts, we leap and play,
Celebrating changes, hip-hip-hooray! 🐇✨


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 29, 2024 01:36
@github-actions github-actions bot merged commit c1b84d3 into main Oct 29, 2024
3 checks passed
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Update openapi.yaml with new endpoint and modified JSON schemas Oct 29, 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 (2)
src/libs/LangSmith/openapi.yaml (2)

Line range hint 10288-10449: Consider reducing schema duplication using composition.

The AIMessage and AIMessageChunk schemas have been split into Input/Output variants, which improves type safety. However, there's significant duplication between these variants.

Consider using OpenAPI composition to reduce duplication:

# Base schema for common properties
AIMessageBase:
  type: object
  required:
    - content
  properties:
    content:
      title: Content
      anyOf:
        - type: string
        - type: array
          items:
            anyOf:
              - type: string
              - type: object
    # ... other common properties

# Input/Output specific schemas
AIMessage-Input:
  allOf:
    - $ref: '#/components/schemas/AIMessageBase'
    - type: object
      # Input specific properties

AIMessage-Output:
  allOf:
    - $ref: '#/components/schemas/AIMessageBase'
    - type: object
      # Output specific properties

15746-15815: Enhance schema documentation and extensibility.

The PlaygroundPromptCanvas schemas are well-structured, but could benefit from some improvements:

  1. Enum values need descriptions
  2. Template format options are limited
  3. Reading levels might need localization support

Consider these enhancements:

 reading_level:
   title: Reading Level
   enum:
     - child
     - teenager
     - college
     - phd
   type: string
+  description: Target audience reading comprehension level
+  x-enum-descriptions:
+    child: "Simple language for ages 7-12"
+    teenager: "Moderate complexity for ages 13-17"
+    college: "Advanced vocabulary for undergraduate level"
+    phd: "Technical/specialized language for expert level"

 template_format:
   title: Template Format
   enum:
     - f-string
     - mustache
+    - jinja2
+    - handlebars
   type: string
+  description: Template syntax format for variable substitution
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 81bb8c9 and 788c37c.

⛔ Files ignored due to path filters (68)
  • 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.AIMessageInputType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageInputTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageOutputType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.AIMessageOutputTypeNullable.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.PlayGroundGraphMessageDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasPayloadArtifactLength.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasPayloadArtifactLengthNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasPayloadMessageDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasPayloadMessageDiscriminatorTypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasPayloadReadingLevel.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasPayloadReadingLevelNullable.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasPayloadTemplateFormat.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/JsonConverters.PlaygroundPromptCanvasPayloadTemplateFormatNullable.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.IPublicClient.GetToolDefJsonSchema.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkInput.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.AIMessageChunkInputType.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.AIMessageChunkOutputAdditionalKwargs.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.AIMessageInput.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageInputAdditionalKwargs.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageInputContentVariant2Item.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageInputResponseMetadata.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.AIMessageInputType.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.AIMessageOutputAdditionalKwargs.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.AIMessageOutputResponseMetadata.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.CanvasApiV1PromptsCanvasPostResponse.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.GetToolDefJsonSchemaApiV1PublicSchemasVersionTooldefJsonGetResponse.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.PlayGroundGraphMessageDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasPayload.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasPayloadArtifactLength.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasPayloadMessageDiscriminator.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasPayloadMessageDiscriminatorType.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasPayloadReadingLevel.g.cs is excluded by !**/generated/**
  • src/libs/LangSmith/Generated/LangSmith.Models.PlaygroundPromptCanvasPayloadTemplateFormat.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/**
  • src/libs/LangSmith/Generated/LangSmith.PublicClient.GetToolDefJsonSchema.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/LangSmith/openapi.yaml (5 hunks)
🔇 Additional comments (1)
src/libs/LangSmith/openapi.yaml (1)

7415-7423: LGTM: Schema references updated correctly.

The schema references have been properly updated to use the new PlaygroundPromptCanvas payload and response types.

Comment on lines +5736 to +5760
'/api/v1/public/schemas/{version}/tooldef.json':
get:
tags:
- public
summary: Get Tool Def Json Schema
operationId: get_tool_def_json_schema_api_v1_public_schemas__version__tooldef_json_get
parameters:
- name: version
in: path
required: true
schema:
title: Version
type: string
responses:
'200':
description: Successful Response
content:
application/json:
schema: { }
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Endpoint definition needs additional details.

The new tool definition endpoint has several areas that need attention:

  1. The response schema is empty (schema: { }).
  2. The version parameter lacks constraints or allowed values.
  3. Missing description of what constitutes a tool definition.

Consider adding these improvements:

  schema:
    title: Version
    type: string
+   description: Version of the tool definition schema
+   enum: ["v1", "v2"]  # Add supported versions
+   example: "v1"

  responses:
    '200':
      description: Successful Response
      content:
        application/json:
-         schema: { }
+         schema:
+           type: object
+           description: JSON Schema defining the structure of tool definitions

Committable suggestion was skipped due to low confidence.

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