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 new endpoints and improve LangSmith API functionality and documentation #30

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Aug 22, 2024

Summary by CodeRabbit

  • New Features

    • Introduced functionality to retrieve chart previews via a new API endpoint.
    • Added new endpoints for health checks and chart management.
    • Created several data models to facilitate custom chart requests and responses, enhancing API flexibility.
  • Bug Fixes

    • Enhanced error handling and response processing for API requests.
  • Documentation

    • Updated OpenAPI specification to reflect new endpoints and changes in response structures.

@github-actions github-actions bot enabled auto-merge August 22, 2024 09:19
Copy link

coderabbitai bot commented Aug 22, 2024

Walkthrough

The changes introduce new features and enhance existing functionalities within the LangSmith API. New endpoints for chart previews and health checks are established, alongside updates to response structures and request models. The API's versioning is clarified through method renaming, and improvements to JSON serialization are implemented across various data models. Additionally, documentation is refined, and properties are added to enhance data handling capabilities.

Changes

Files Change Summary
src/libs/LangSmith/Generated/LangSmith.ChartsClient.ReadChartPreviewApiV1ChartsPreviewPost.g.cs Introduced ChartsClient class with ReadChartPreviewApiV1ChartsPreviewPostAsync methods for retrieving chart previews.
src/libs/LangSmith/Generated/LangSmith.LangSmithApi.OkApiV1OkGet.g.cs Renamed methods to reflect new API versioning (e.g., OkApiV1OkGetAsync), aligning with updated endpoint structure.
src/libs/LangSmith/Generated/LangSmith.Models.CustomChartCreatePreview.g.cs Introduced CustomChartCreatePreview class with properties for chart series and additional metadata.
src/libs/LangSmith/Generated/LangSmith.Models.CustomChartPreviewRequest.g.cs Defined CustomChartPreviewRequest class for structured chart preview requests, including required properties.
src/libs/LangSmith/Generated/LangSmith.Models.CustomChartsRequestBase.g.cs Added CustomChartsRequestBase class with properties for chart parameters, supporting additional dynamic properties.
src/libs/LangSmith/Generated/LangSmith.Models.OkApiV1OkGetResponse.g.cs Changed class name from OkOkGetResponse to OkApiV1OkGetResponse for clarity in API versioning.
src/libs/LangSmith/Generated/LangSmith.Models.SingleCustomChartResponse.g.cs Added Data property to SingleCustomChartResponse class, ensuring its presence in JSON serialization.
src/libs/LangSmith/Generated/LangSmith.Models.SingleCustomChartResponseBase.g.cs Introduced SingleCustomChartResponseBase class with properties for structured custom chart responses.
src/libs/LangSmith/Generated/LangSmith.RunClient.QueryRunsApiV1RunsQueryPost.g.cs Removed HTML tags from documentation comments in the ProcessQueryRunsApiV1RunsQueryPostResponseContent method for clarity.
src/libs/LangSmith/openapi.yaml Modified OpenAPI specification: removed description for /api/v1/runs/query, added endpoints for /api/v1/charts/preview and /api/v1/ok, and updated schemas.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ChartsClient
    participant API
    participant ResponseHandler

    User->>ChartsClient: ReadChartPreviewApiV1ChartsPreviewPostAsync(request)
    ChartsClient->>API: POST /api/v1/charts/preview
    API->>ChartsClient: Chart preview response
    ChartsClient->>ResponseHandler: Process response
    ResponseHandler-->>User: Return chart preview
Loading

🐇 "In the garden of code, where the rabbits play,
New features hop in, brightening the day.
With charts and previews, all spruced up nice,
The API dances, oh what a slice!
Health checks are ready, the paths are all clear,
Hooray for the changes, let’s give them a cheer!" 🥕✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Add new endpoints and improve LangSmith API functionality and documentation Aug 22, 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, codebase verification and nitpick comments (10)
src/libs/LangSmith/Generated/LangSmith.Models.CustomChartCreatePreview.g.cs (3)

6-8: Add a class summary.

The class lacks a summary description. Consider adding a brief explanation of the class's purpose.

 /// <summary>
-/// 
+/// Represents a preview of a custom chart creation.
 /// </summary>

11-13: Add a property summary for Series.

The Series property lacks a summary description. Consider adding a brief explanation of what this property represents.

 /// <summary>
-/// 
+/// Gets or sets the series data for the custom chart.
 /// </summary>

18-20: Add a property summary for AdditionalProperties.

The AdditionalProperties property lacks a summary description. Consider adding a brief explanation of what this property represents.

 /// <summary>
-/// Additional properties that are not explicitly defined in the schema
+/// Gets or sets additional properties that are not explicitly defined in the schema.
 /// </summary>
src/libs/LangSmith/Generated/LangSmith.Models.SingleCustomChartResponseBase.g.cs (3)

6-8: Add a class summary.

The class lacks a summary description. Consider adding a brief explanation of the class's purpose.

 /// <summary>
-/// 
+/// Represents the base response for a single custom chart.
 /// </summary>

11-13: Add a property summary for Data.

The Data property lacks a summary description. Consider adding a brief explanation of what this property represents.

 /// <summary>
-/// 
+/// Gets or sets the data points for the custom chart.
 /// </summary>

18-20: Add a property summary for AdditionalProperties.

The AdditionalProperties property lacks a summary description. Consider adding a brief explanation of what this property represents.

 /// <summary>
-/// Additional properties that are not explicitly defined in the schema
+/// Gets or sets additional properties that are not explicitly defined in the schema.
 /// </summary>
src/libs/LangSmith/Generated/LangSmith.Models.CustomChartPreviewRequest.g.cs (4)

6-8: Add a class summary.

The class lacks a summary description. Consider adding a brief explanation of the class's purpose.

 /// <summary>
-/// 
+/// Represents a request for a custom chart preview.
 /// </summary>

11-13: Add a property summary for BucketInfo.

The BucketInfo property lacks a summary description. Consider adding a brief explanation of what this property represents.

 /// <summary>
-/// 
+/// Gets or sets the bucket information for the custom chart request.
 /// </summary>

18-20: Add a property summary for Chart.

The Chart property lacks a summary description. Consider adding a brief explanation of what this property represents.

 /// <summary>
-/// 
+/// Gets or sets the chart details for the custom chart preview.
 /// </summary>

25-27: Add a property summary for AdditionalProperties.

The AdditionalProperties property lacks a summary description. Consider adding a brief explanation of what this property represents.

 /// <summary>
-/// Additional properties that are not explicitly defined in the schema
+/// Gets or sets additional properties that are not explicitly defined in the schema.
 /// </summary>
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 733f18b and 679d205.

Files selected for processing (10)
  • src/libs/LangSmith/Generated/LangSmith.ChartsClient.ReadChartPreviewApiV1ChartsPreviewPost.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.LangSmithApi.OkApiV1OkGet.g.cs (5 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.CustomChartCreatePreview.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.CustomChartPreviewRequest.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.CustomChartsRequestBase.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.OkApiV1OkGetResponse.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.SingleCustomChartResponse.g.cs (2 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.SingleCustomChartResponseBase.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.RunClient.QueryRunsApiV1RunsQueryPost.g.cs (2 hunks)
  • src/libs/LangSmith/openapi.yaml (9 hunks)
Files skipped from review due to trivial changes (2)
  • src/libs/LangSmith/Generated/LangSmith.Models.OkApiV1OkGetResponse.g.cs
  • src/libs/LangSmith/Generated/LangSmith.RunClient.QueryRunsApiV1RunsQueryPost.g.cs
Additional context used
GitHub Check: Test / Build, test and publish
src/libs/LangSmith/Generated/LangSmith.ChartsClient.ReadChartPreviewApiV1ChartsPreviewPost.g.cs

[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)


[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)


[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)


[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)


[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)

Additional comments not posted (22)
src/libs/LangSmith/Generated/LangSmith.Models.CustomChartsRequestBase.g.cs (5)

16-17: LGTM!

The Timezone property is well-defined with a default value of "UTC".


22-24: LGTM!

The StartTime property is correctly marked as required.


29-31: LGTM!

The EndTime property is well-defined with a custom converter to handle multiple types.


36-38: LGTM!

The Stride property is correctly defined with a custom converter for complex types.


43-44: LGTM!

The AdditionalProperties property is correctly defined to handle extra data.

src/libs/LangSmith/Generated/LangSmith.Models.SingleCustomChartResponse.g.cs (1)

16-18: LGTM!

The Data property is correctly marked as required and uses appropriate JSON serialization attributes.

src/libs/LangSmith/Generated/LangSmith.LangSmithApi.OkApiV1OkGet.g.cs (5)

8-9: LGTM!

The method PrepareOkApiV1OkGetArguments is correctly renamed to align with the new API versioning scheme.


10-12: LGTM!

The method PrepareOkApiV1OkGetRequest is correctly renamed to align with the new API versioning scheme.


13-15: LGTM!

The method ProcessOkApiV1OkGetResponse is correctly renamed to align with the new API versioning scheme.


17-19: LGTM!

The method ProcessOkApiV1OkGetResponseContent is correctly renamed to align with the new API versioning scheme.


Line range hint 27-79: LGTM!

The method OkApiV1OkGetAsync is correctly renamed and updated to align with the new API versioning scheme and endpoint structure.

src/libs/LangSmith/Generated/LangSmith.ChartsClient.ReadChartPreviewApiV1ChartsPreviewPost.g.cs (2)

84-91: LGTM! Error handling logic is appropriate.

The error handling for unsuccessful HTTP responses is well-implemented using EnsureSuccessStatusCode and catching HttpRequestException.


106-120: LGTM! Method implementation is correct.

The method correctly constructs a CustomChartPreviewRequest and calls the other overload.

src/libs/LangSmith/openapi.yaml (9)

Line range hint 1-5: Verify the removal of the description for /api/v1/runs/query.

The description for this endpoint has been removed. Ensure that this change is intentional and does not impact the understanding of the API's functionality.


7769-7798: LGTM! But verify the associated schemas for /api/v1/charts/preview.

The addition of the /api/v1/charts/preview endpoint is well-defined.

Ensure that the CustomChartPreviewRequest and SingleCustomChartResponseBase schemas are correctly implemented and meet the expected requirements.


8002-8011: Approved: Addition of /api/v1/ok endpoint.

The /api/v1/ok endpoint is a useful addition for health checks and connectivity confirmation.


Line range hint 1-5: Approved: Security requirements.

The security requirements are consistent and correctly applied.


10283-10293: LGTM! But verify the CustomChartSeries schema for CustomChartCreatePreview.

The CustomChartCreatePreview schema is well-defined.

Ensure that the CustomChartSeries schema is correctly implemented and meets the expected requirements.


10316-10326: LGTM! But verify the referenced schemas for CustomChartPreviewRequest.

The CustomChartPreviewRequest schema is well-defined.

Ensure that the CustomChartsRequestBase and CustomChartCreatePreview schemas are correctly implemented and meet the expected requirements.


10583-10609: LGTM! But verify the TimedeltaInput schema for CustomChartsRequestBase.

The CustomChartsRequestBase schema is well-defined.

Ensure that the TimedeltaInput schema is correctly implemented and meets the expected requirements.


16269-16281: LGTM! But verify the CustomChartsDataPoint schema for SingleCustomChartResponse.

The addition of the data property to the SingleCustomChartResponse schema is appropriate.

Ensure that the CustomChartsDataPoint schema is correctly implemented and meets the expected requirements.


16309-16314: Approved: Addition of SingleCustomChartResponseBase schema.

The SingleCustomChartResponseBase schema is well-defined and consistent with other response schemas.

Comment on lines +94 to +95
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::LangSmith.SourceGenerationContext.Default.NullableSingleCustomChartResponseBase) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
Copy link

Choose a reason for hiding this comment

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

Fix the deserialization issue.

The SourceGenerationContext does not contain a definition for NullableSingleCustomChartResponseBase, which causes a build failure.

Ensure that NullableSingleCustomChartResponseBase is correctly defined or imported. If it's missing, consider adding it to SourceGenerationContext or replacing it with the correct type.

Tools
GitHub Check: Test / Build, test and publish

[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)


[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)


[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)


[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)


[failure] 94-94:
'SourceGenerationContext' does not contain a definition for 'NullableSingleCustomChartResponseBase' and no accessible extension method 'NullableSingleCustomChartResponseBase' accepting a first argument of type 'SourceGenerationContext' could be found (are you missing a using directive or an assembly reference?)

@HavenDV HavenDV disabled auto-merge August 22, 2024 09:49
@HavenDV HavenDV merged commit 4b3eb3e into main Aug 22, 2024
2 of 3 checks passed
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