Skip to content

feat:Enhance LangSmith SSO settings and code evaluation with new classes and APIs#48

Merged
github-actions[bot] merged 1 commit intomainfrom
bot/update-openapi_202409061825
Sep 6, 2024
Merged

feat:Enhance LangSmith SSO settings and code evaluation with new classes and APIs#48
github-actions[bot] merged 1 commit intomainfrom
bot/update-openapi_202409061825

Conversation

@HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Sep 6, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new API endpoints for managing Single Sign-On (SSO) settings, including retrieval and creation.
    • Added functionality to trigger run rules via a new API endpoint.
    • Enhanced data models to support new properties for SSO providers and configuration settings.
    • Added support for code evaluators in various request and response structures.
  • Bug Fixes

    • Improved error handling for API requests to ensure clearer feedback on failures.
  • Documentation

    • Updated OpenAPI specification to reflect new endpoints and data models, enhancing clarity for developers.

@github-actions github-actions bot enabled auto-merge September 6, 2024 18:25
@coderabbitai
Copy link

coderabbitai bot commented Sep 6, 2024

Walkthrough

The changes introduce several new classes and properties to the LangSmith namespace, enhancing the handling of Single Sign-On (SSO) settings and code evaluation features. New API endpoints for managing SSO settings and triggering rules are defined, along with updates to existing schemas. The modifications improve the flexibility and extensibility of the data models and API interactions.

Changes

Files Change Summary
src/libs/LangSmith/Generated/LangSmith.Models.CodeEvaluatorTopLevel.g.cs
src/libs/LangSmith/Generated/LangSmith.Models.CreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostResponse.g.cs
src/libs/LangSmith/Generated/LangSmith.Models.SSOProvider.g.cs
src/libs/LangSmith/Generated/LangSmith.Models.SSOSettingsCreate.g.cs
src/libs/LangSmith/Generated/LangSmith.Models.TriggerRulesRequest.g.cs
New classes and properties for code evaluation, SSO settings creation, and request handling.
src/libs/LangSmith/Generated/LangSmith.Models.OrgFeatureFlags.g.cs
src/libs/LangSmith/Generated/LangSmith.Models.OrganizationConfig.g.cs
Added new enum value and boolean property to manage feature flags and SAML SSO settings.
src/libs/LangSmith/Generated/LangSmith.Models.RunRulesCreateSchema.g.cs
src/libs/LangSmith/Generated/LangSmith.Models.RunRulesSchema.g.cs
Introduced CodeEvaluators property to handle collections of code evaluator objects.
src/libs/LangSmith/Generated/LangSmith.OrgsClient.CreateSsoSettingsApiV1OrgsCurrentSsoSettingsPost.g.cs
src/libs/LangSmith/Generated/LangSmith.OrgsClient.GetCurrentSsoSettingsApiV1OrgsCurrentSsoSettingsGet.g.cs
New methods for creating and retrieving SSO settings via API calls.
src/libs/LangSmith/Generated/LangSmith.RunClient.TriggerRulesApiV1RunsRulesTriggerPost.g.cs
src/libs/LangSmith/Generated/LangSmith.RunClient.UpdateRuleApiV1RunsRulesRuleIdPatch.g.cs
Updated methods to process additional parameters for handling code evaluators in rule processing.
src/libs/LangSmith/openapi.yaml Added new API endpoints and updated schemas for SSO settings management and rule triggering.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant OrgsClient
    participant API
    participant SSOProvider

    Client->>OrgsClient: Create SSO Settings
    OrgsClient->>API: POST /api/v1/orgs/current/sso-settings
    API-->>OrgsClient: Response with SSO Settings
    OrgsClient-->>Client: Return SSO Settings

    Client->>OrgsClient: Get Current SSO Settings
    OrgsClient->>API: GET /api/v1/orgs/current/sso-settings
    API-->>OrgsClient: Response with SSO Providers
    OrgsClient-->>Client: Return SSO Providers
Loading

🐇 "In the fields where the daisies bloom,
New features hop, dispelling gloom.
With SSO settings now in sight,
Code evaluators take their flight.
Hooray for changes, let’s all cheer,
A brighter future, oh so 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>.
    • 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 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 merged commit 6f04c25 into main Sep 6, 2024
@coderabbitai coderabbitai bot changed the title feat:@coderabbitai feat:Enhance LangSmith SSO settings and code evaluation with new classes and APIs Sep 6, 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: 4

Outside diff range, codebase verification and nitpick comments (7)
src/libs/LangSmith/Generated/LangSmith.Models.SSOSettingsCreateAttributeMapping.g.cs (1)

6-8: Suggestion: Add a descriptive summary.

The summary documentation is currently empty. It would be beneficial to provide a brief description of the SSOSettingsCreateAttributeMapping class to improve code readability and maintainability.

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

6-8: Suggestion: Add a descriptive summary.

The class summary is empty. Adding a descriptive summary would enhance the understanding of the class's purpose and usage.

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

6-8: Suggestion: Add a descriptive summary.

It is recommended to add a descriptive summary to the class documentation to clarify its role and functionality.

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

6-23: Well-structured class for JSON serialization.

The CodeEvaluatorTopLevel class is well-defined with appropriate JSON serialization attributes and nullable reference types. The use of required keyword and JsonRequired attribute ensures strict data handling, which is crucial for the integrity of the data model.

However, the XML documentation comments are missing descriptions. Adding detailed comments would improve code maintainability and readability.

Consider adding detailed XML documentation comments to explain the purpose and usage of the class and its properties.

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

6-23: Well-structured class for JSON serialization.

The TriggerRulesRequest class is well-defined with appropriate JSON serialization attributes and nullable reference types. The use of required keyword and JsonRequired attribute ensures strict data handling, which is crucial for the integrity of the data model.

However, the XML documentation comments are missing descriptions. Adding detailed comments would improve code maintainability and readability.

Consider adding detailed XML documentation comments to explain the purpose and usage of the class and its properties.

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

6-37: Well-structured class with flexible JSON handling.

The SSOSettingsCreate class is well-defined with appropriate JSON serialization attributes, custom converters, and nullable reference types. The use of custom JSON converters (AnyOfJsonConverterFactory2) for MetadataXml and MetadataUrl is particularly noteworthy for handling different data types flexibly.

However, the XML documentation comments are missing descriptions, and there is a pragma directive to disable warnings for obsolete members. Adding detailed comments would improve code maintainability and readability, and the use of obsolete members should be reviewed to ensure they are still necessary.

Consider adding detailed XML documentation comments to explain the purpose and usage of the class and its properties. Review the necessity of the pragma directive for obsolete members.

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

157-163: Approve the addition of CodeEvaluators but recommend adding a descriptive summary.

The new property CodeEvaluators is correctly implemented with appropriate JSON serialization attributes and uses the System.AnyOf type for flexibility. However, the summary tag is empty and should be filled with a descriptive comment to explain the purpose and usage of this property.

Consider adding a descriptive summary to the property:

-        /// <summary>
-        /// 
-        /// </summary>
+        /// <summary>
+        /// Holds a collection of code evaluator configurations that can be used to dynamically assess code rules.
+        /// </summary>
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8af8c84 and eb7f874.

Files selected for processing (17)
  • src/libs/LangSmith/Generated/LangSmith.Models.CodeEvaluatorTopLevel.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.CreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostResponse.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.OrgFeatureFlags.g.cs (3 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.OrganizationConfig.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.RunRulesCreateSchema.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.RunRulesSchema.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.SSOProvider.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.SSOSettingsCreate.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.SSOSettingsCreateAttributeMapping.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.TriggerRulesApiV1RunsRulesTriggerPostResponse.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.Models.TriggerRulesRequest.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.OrgsClient.CreateSsoSettingsApiV1OrgsCurrentSsoSettingsPost.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.OrgsClient.GetCurrentSsoSettingsApiV1OrgsCurrentSsoSettingsGet.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.RunClient.CreateRuleApiV1RunsRulesPost.g.cs (3 hunks)
  • src/libs/LangSmith/Generated/LangSmith.RunClient.TriggerRulesApiV1RunsRulesTriggerPost.g.cs (1 hunks)
  • src/libs/LangSmith/Generated/LangSmith.RunClient.UpdateRuleApiV1RunsRulesRuleIdPatch.g.cs (3 hunks)
  • src/libs/LangSmith/openapi.yaml (10 hunks)
Additional comments not posted (19)
src/libs/LangSmith/Generated/LangSmith.Models.SSOSettingsCreateAttributeMapping.g.cs (2)

2-2: Approved: Use of nullable reference types.

The use of #nullable enable is appropriate and enhances type safety by explicitly handling null values in the code.


12-16: Approved: Use of JsonExtensionData attribute.

The use of JsonExtensionData attribute for the AdditionalProperties dictionary is appropriate. It allows for serialization and deserialization of additional JSON properties that are not matched by the class properties, which is useful for handling dynamic properties in JSON data.

src/libs/LangSmith/Generated/LangSmith.Models.TriggerRulesApiV1RunsRulesTriggerPostResponse.g.cs (2)

2-2: Approved: Use of nullable reference types.

Enabling nullable reference types is a good practice for modern C# development, ensuring better handling of null values.


12-16: Approved: Use of JsonExtensionData attribute.

The JsonExtensionData attribute is correctly applied to the AdditionalProperties dictionary, facilitating the handling of extra JSON properties that do not have corresponding class properties.

src/libs/LangSmith/Generated/LangSmith.Models.CreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostResponse.g.cs (2)

2-2: Approved: Use of nullable reference types.

Continued use of nullable reference types across new files is a good practice, enhancing type safety and null handling in the codebase.


12-16: Approved: Use of JsonExtensionData attribute.

The application of the JsonExtensionData attribute on the AdditionalProperties dictionary is correct and useful for handling additional JSON properties dynamically.

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

82-86: Well-implemented new property CanUseSamlSso.

The addition of the CanUseSamlSso property is well-executed with clear documentation and appropriate default settings:

  • The property is correctly annotated for serialization.
  • The default value of false is a prudent choice for security-sensitive settings.

This change enhances the configuration capabilities of the OrganizationConfig class by allowing it to manage SAML SSO settings effectively.

src/libs/LangSmith/Generated/LangSmith.OrgsClient.GetCurrentSsoSettingsApiV1OrgsCurrentSsoSettingsGet.g.cs (1)

22-82: Robust implementation of SSO settings retrieval.

The method GetCurrentSsoSettingsApiV1OrgsCurrentSsoSettingsGetAsync is well-designed and implemented:

  • It includes comprehensive steps for preparing, sending, and processing HTTP requests.
  • Exception handling is robust, ensuring that HTTP errors are managed effectively.
  • The use of ConfigureAwait(false) is appropriate for avoiding deadlocks in library code.

This method effectively supports the new API endpoints for managing SSO settings as described in the PR summary.

src/libs/LangSmith/Generated/LangSmith.Models.OrgFeatureFlags.g.cs (2)

114-114: Approved: Updated ToValueString method.

The update to include the ArbitraryCodeExecutionEnabled enum value in the ToValueString method is correct and follows the established pattern.


142-142: Approved: Updated ToEnum method.

The update to include the reverse mapping for "arbitrary_code_execution_enabled" to ArbitraryCodeExecutionEnabled in the ToEnum method is correct and follows the established pattern.

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

121-127: Well-implemented new property addition.

The addition of the CodeEvaluators property to the RunRulesCreateSchema class is well-implemented. The use of the AnyOf type enhances flexibility, and the JSON serialization attributes are correctly applied to ensure proper data handling.

src/libs/LangSmith/Generated/LangSmith.RunClient.CreateRuleApiV1RunsRulesPost.g.cs (1)

Line range hint 126-148: Enhanced method functionality with new parameter addition.

The addition of the codeEvaluators parameter to the ProcessCreateRuleApiV1RunsRulesPostResponseContent method enhances its functionality, allowing it to handle a broader range of evaluators. The updates to the method's documentation and signature are well-executed, ensuring clarity and maintainability.

Also applies to: 171-171

src/libs/LangSmith/Generated/LangSmith.RunClient.UpdateRuleApiV1RunsRulesRuleIdPatch.g.cs (1)

Line range hint 133-156: Enhanced method functionality with new parameter addition.

The addition of the codeEvaluators parameter to the ProcessUpdateRuleApiV1RunsRulesRuleIdPatchResponseContent method enhances its functionality, allowing it to handle code evaluators alongside the existing evaluators, alerts, and webhooks. The updates to the method's documentation and signature are well-executed, ensuring clarity and maintainability.

Also applies to: 179-179

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

1309-1329: Review of GET /api/v1/orgs/current/sso-settings Endpoint

This new endpoint is well-defined with appropriate tags, summary, description, and operation ID. The response schema correctly references the SSOProvider schema, which should be reviewed for accuracy in its definition. Security requirements are clearly specified, ensuring that appropriate authentication is enforced.


1330-1359: Review of POST /api/v1/orgs/current/sso-settings Endpoint

This endpoint for creating SSO settings is correctly set up with comprehensive details including tags, summary, description, and operation ID. The request body schema SSOSettingsCreate needs to be validated to ensure it meets the requirements for creating SSO settings. The response and error handling are appropriately defined, and security requirements are specified.


3444-3472: Review of POST /api/v1/runs/rules/trigger Endpoint

This endpoint allows for triggering an array of run rules manually, which is a significant addition for operational flexibility. The request body schema TriggerRulesRequest is used here and should be checked for correctness. The endpoint is secured with API key and tenant ID, which is appropriate for such operations.


16306-16330: Review of SSOProvider Schema

The SSOProvider schema is well-structured with necessary fields such as id, provider_id, metadata_url, and metadata_xml. Each field is appropriately typed, and the schema is used in the GET endpoint for SSO settings. Ensure that the fields meet the integration requirements of SSO providers.


16332-16349: Review of SSOSettingsCreate Schema

This schema for creating SSO settings includes fields for metadata_xml, metadata_url, and attribute_mapping. It is crucial that these fields are validated against the SSO provider's requirements. The schema is used in the POST endpoint for creating SSO settings, and it is essential to ensure that it captures all necessary details for a successful SSO configuration.


17865-17876: Review of TriggerRulesRequest Schema

The TriggerRulesRequest schema is designed to handle the request for triggering rules manually. It includes an array of rule_ids, which are expected to be in UUID format. This schema is crucial for the operation of the new POST endpoint for triggering rules and should be validated to ensure that it correctly handles the rule IDs.

Comment on lines +6 to +46
namespace LangSmith
{
/// <summary>
///
/// </summary>
public sealed partial class SSOProvider
{
/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string Id { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("provider_id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string ProviderId { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("metadata_url")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AnyOfJsonConverterFactory2))]
public global::System.AnyOf<string, object>? MetadataUrl { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("metadata_xml")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AnyOfJsonConverterFactory2))]
public global::System.AnyOf<string, object>? MetadataXml { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
Copy link

Choose a reason for hiding this comment

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

Well-structured class definition for SSOProvider.

The class SSOProvider is well-defined with appropriate use of attributes and properties:

  • The use of sealed and partial is appropriate for generated classes.
  • Properties Id and ProviderId are correctly marked as required.
  • The use of custom JSON converters for MetadataUrl and MetadataXml is a good practice, providing flexibility in accepted data types.
  • The AdditionalProperties dictionary enhances the class's ability to handle data beyond the predefined schema.

Suggestion: Add documentation.
The summary tags for properties are empty. Adding descriptive comments would improve the readability and maintainability of the code.

Comment on lines +79 to +82
/// <summary>
///
/// </summary>
ArbitraryCodeExecutionEnabled,
Copy link

Choose a reason for hiding this comment

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

Add documentation for the new enum value.

The enum value ArbitraryCodeExecutionEnabled is added correctly, but it lacks a summary documentation. This is crucial for understanding its purpose and implications, especially given its sensitive nature.

Consider adding a detailed description in the summary section:

Committable suggestion was skipped due to low confidence.

Comment on lines +31 to +96
public async global::System.Threading.Tasks.Task<global::LangSmith.TriggerRulesApiV1RunsRulesTriggerPostResponse> TriggerRulesApiV1RunsRulesTriggerPostAsync(
global::LangSmith.TriggerRulesRequest request,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));

PrepareArguments(
client: _httpClient);
PrepareTriggerRulesApiV1RunsRulesTriggerPostArguments(
httpClient: _httpClient,
request: request);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/api/v1/runs/rules/trigger", global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::LangSmith.SourceGenerationContext.Default.TriggerRulesRequest);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
encoding: global::System.Text.Encoding.UTF8,
mediaType: "application/json");
httpRequest.Content = __httpRequestContent;

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareTriggerRulesApiV1RunsRulesTriggerPostRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
request: request);

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
ProcessTriggerRulesApiV1RunsRulesTriggerPostResponse(
httpClient: _httpClient,
httpResponseMessage: response);

var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: _httpClient,
response: response,
content: ref __content);
ProcessTriggerRulesApiV1RunsRulesTriggerPostResponseContent(
httpClient: _httpClient,
httpResponseMessage: response,
content: ref __content);

try
{
response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException ex)
{
throw new global::System.InvalidOperationException(__content, ex);
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::LangSmith.SourceGenerationContext.Default.TriggerRulesApiV1RunsRulesTriggerPostResponse) ??
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.

Approved: Well-structured API method with robust error handling.

The TriggerRulesApiV1RunsRulesTriggerPostAsync method is well-structured and includes robust error handling and response processing. However, consider adding more detailed error logging to aid in debugging and maintaining the service.

Consider enhancing error logging:

Committable suggestion was skipped due to low confidence.

Comment on lines +31 to +96
public async global::System.Threading.Tasks.Task<global::LangSmith.CreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostResponse> CreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostAsync(
global::LangSmith.SSOSettingsCreate request,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));

PrepareArguments(
client: _httpClient);
PrepareCreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostArguments(
httpClient: _httpClient,
request: request);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/api/v1/orgs/current/sso-settings", global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::LangSmith.SourceGenerationContext.Default.SSOSettingsCreate);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
encoding: global::System.Text.Encoding.UTF8,
mediaType: "application/json");
httpRequest.Content = __httpRequestContent;

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareCreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
request: request);

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
ProcessCreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostResponse(
httpClient: _httpClient,
httpResponseMessage: response);

var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: _httpClient,
response: response,
content: ref __content);
ProcessCreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostResponseContent(
httpClient: _httpClient,
httpResponseMessage: response,
content: ref __content);

try
{
response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException ex)
{
throw new global::System.InvalidOperationException(__content, ex);
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::LangSmith.SourceGenerationContext.Default.CreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostResponse) ??
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.

Approved: Well-structured API method with robust error handling.

The CreateSsoSettingsApiV1OrgsCurrentSsoSettingsPostAsync method is well-structured and includes robust error handling and response processing. However, consider adding more detailed error logging to aid in debugging and maintaining the service.

Consider enhancing error logging:

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