feat:OpenAPI: Add assistants/MCP/vector-store endpoints, schema updates#163
feat:OpenAPI: Add assistants/MCP/vector-store endpoints, schema updates#163HavenDV wants to merge 1 commit into
Conversation
WalkthroughAdds new endpoints for assistants, MCP discovery, and vector-store retrieval. Expands and restructures public schemas: introduces assistant requests, MCP entities, new tool resource models, discriminated unions for tools, new enums, requirement type split, vector_store_id fields in bodies, and budget linkage in library upload. All changes occur in the OpenAPI spec. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant API as Studio API
participant Store as Data Store
rect rgb(230,245,255)
note over Client,API: Assistant Creation (new)
Client->>API: POST /studio/v1/assistants (CreateAssistantRequest)
API->>Store: Validate & persist assistant, tools, tool_resources
Store-->>API: Assistant record
API-->>Client: 201 Created (Assistant)
end
rect rgb(240,240,240)
note over Client,API: Assistant Modification (new)
Client->>API: PATCH /studio/v1/assistants/{assistant_id} (ModifyAssistantRequest)
API->>Store: Update fields (models, tools, budget, visibility, etc.)
Store-->>API: Updated assistant
API-->>Client: 200 OK (Assistant)
end
sequenceDiagram
autonumber
actor Client
participant API as Studio API
participant MCP as MCP Server (per MCPDefinition)
rect rgb(235,255,235)
note over Client,API: MCP Tool Discovery (new)
Client->>API: POST /studio/v1/mcp/discover (MCPDefinition)
API->>MCP: Connect using server_url, headers
MCP-->>API: Tools description
API-->>Client: 200 OK (MCPDiscoveryResponse)
end
sequenceDiagram
autonumber
actor Client
participant API as Studio API
participant VS as Vector Store
rect rgb(255,245,230)
note over Client,API: Vector Store Fetch (new)
Client->>API: GET /studio/v1/demos/regulations/vector-store/{vector_store_id}
API->>VS: Retrieve vector store by ID
VS-->>API: Vector store details
API-->>Client: 200 OK (VectorStore)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (9)
src/libs/AI21/openapi.yaml (9)
1018-1043: Add 404 and tag; consider ID format.
- Missing 404 for unknown vector_store_id.
- No tags; add one for consistency with other demo/regulations endpoints.
- If IDs are UUIDs, add format: uuid.
Apply this diff:
'/studio/v1/demos/regulations/vector-store/{vector_store_id}': get: + tags: + - Regulations summary: Get Vector Store description: Get a vector store by ID. operationId: get_vector_store_studio_v1_demos_regulations_vector_store__vector_store_id__get parameters: - name: vector_store_id in: path required: true schema: title: Vector Store Id type: string + format: uuid responses: '200': description: Successful Response content: application/json: schema: title: Response Get Vector Store Studio V1 Demos Regulations Vector Store Vector Store Id Get type: object + '404': + description: Vector store not found + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError'
2258-2262: Fix misleading description for vector_store_id.This payload is for “upload-check-compliance”; description says “RFI processing”.
vector_store_id: title: Vector Store Id type: string - description: Vector store ID to use for RFI processing + description: Vector store ID to use for compliance checks
2677-2683: ConversationalRagConfig: add constraints.
- max_documents lacks minimum.
- response_language default ‘unset’ is good.
retrieval_strategy: allOf: - $ref: '#/components/schemas/RetrievalStrategy' default: segments max_documents: title: Max Documents type: integer + minimum: 1Also applies to: 2707-2710
3270-3331: FileSearchToolResource: add bounds and minima.
- retrieval_similarity_threshold and hybrid_search_alpha should be [0.0,1.0].
- max_neighbors should be ≥1.
- Consider minItems for file_ids/labels when provided.
retrieval_similarity_threshold: title: Retrieval Similarity Threshold type: number - default: 0 + default: 0 + minimum: 0.0 + maximum: 1.0 ... max_neighbors: title: Max Neighbors type: integer default: 1 + minimum: 1 ... hybrid_search_alpha: title: Hybrid Search Alpha type: number default: 1 + minimum: 0.0 + maximum: 1.0
3371-3455: HTTP tool schemas: add URI format and header typing; require ‘type’.
- url fields should be format: uri.
- headers should constrain values to strings.
- Require ‘type’ to satisfy the discriminator.
HTTPToolEndpoint: title: HTTPToolEndpoint required: - url type: object properties: url: title: Url type: string + format: uri headers: title: Headers - type: object + type: object + additionalProperties: + type: string ... HTTPToolResource: title: HTTPToolResource - required: - - function - - endpoint + required: + - type + - function + - endpoint
3643-3713: MCP schemas: add URI format, require ‘type’, and type headers.MCPDefinition: title: MCPDefinition required: - server_url type: object properties: server_url: title: Server Url type: string + format: uri server_label: title: Server Label type: string headers: title: Headers - type: object + type: object + additionalProperties: + type: string ... MCPToolResource: title: MCPToolResource - required: - - server_label - - server_url + required: + - type + - server_label + - server_url
4388-4405: WebSearchToolResource: add minItems for urls.Also consider clarifying precedence when both urls and fallback_to_web are set.
urls: title: Urls type: array items: type: string + minItems: 1
4548-4564: Distinct titles to avoid codegen confusion.Both schemas have title “Requirement”; give unique titles.
- language_studio_api_server__data_types__assistant__Requirement: - title: Requirement + language_studio_api_server__data_types__assistant__Requirement: + title: AssistantRequirement ... - language_studio_api_server__data_types__execution_engine__Requirement: - title: Requirement + language_studio_api_server__data_types__execution_engine__Requirement: + title: ExecutionEngineRequirementAlso applies to: 4565-4580
2873-2879: Unify budget typing.This payload inlines low/medium/high. Prefer referencing BudgetLevel for consistency and single source of truth.
Proposed change (outside this hunk):
CreateMaestroRunsPayload: properties: budget: - title: Budget - enum: [low, medium, high] - type: string + allOf: + - $ref: '#/components/schemas/BudgetLevel'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (111)
src/libs/AI21/Generated/AI21..JsonSerializerContext.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Ai21Api.GetVectorStoreStudioV1DemosRegulationsVectorStoreVectorStoreIdGet.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Ai21Api.McpToolDiscoveryStudioV1McpDiscoverPost.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Ai21Api.UploadCheckComplianceStudioV1DemosRegulationsUploadCheckCompliancePost.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Ai21Api.V1ConversationalRag.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Ai21Api.V1CreateAssistant.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Ai21Api.V1MaestroRun.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Ai21Api.V1ModifyAssistant.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.IAi21Api.GetVectorStoreStudioV1DemosRegulationsVectorStoreVectorStoreIdGet.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.IAi21Api.McpToolDiscoveryStudioV1McpDiscoverPost.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.IAi21Api.UploadCheckComplianceStudioV1DemosRegulationsUploadCheckCompliancePost.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.IAi21Api.V1ConversationalRag.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.IAi21Api.V1CreateAssistant.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.IAi21Api.V1MaestroRun.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.IAi21Api.V1ModifyAssistant.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.BudgetLevel.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.BudgetLevelNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.CreateMaestroRunsPayloadToolDiscriminatorType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.CreateMaestroRunsPayloadToolDiscriminatorTypeNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.FileSearchToolResourceLabelsFilterMode.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.FileSearchToolResourceLabelsFilterModeNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.FileSearchToolResourceResponseLanguage.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.FileSearchToolResourceResponseLanguageNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.FileSearchToolResourceType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.FileSearchToolResourceTypeNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.HTTPToolFunctionParametersType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.HTTPToolFunctionParametersTypeNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.HTTPToolResourceType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.HTTPToolResourceTypeNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.MCPToolResourceType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.MCPToolResourceTypeNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.RunOptimization.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.RunOptimizationNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.ToolsItem.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.Visibility.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.VisibilityNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.WebSearchToolResourceType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonConverters.WebSearchToolResourceTypeNullable.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.Assistant.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.BodyUploadCheckComplianceStudioV1DemosRegulationsUploadCheckCompliancePost.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.BudgetLevel.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ConversationalRagConfig.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ConversationalRagConfigResponseLanguage.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ConversationalRagConfigRetrievalStrategy.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateAssistantRequest.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateAssistantRequest.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateAssistantRequestTool.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateAssistantRequestTool.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateAssistantRequestToolResources.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateAssistantRequestToolResources.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateMaestroRunsPayload.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateMaestroRunsPayloadResponseLanguage.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateMaestroRunsPayloadToolDiscriminator.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateMaestroRunsPayloadToolDiscriminator.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.CreateMaestroRunsPayloadToolDiscriminatorType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.FileSearchToolResource.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.FileSearchToolResource.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.FileSearchToolResourceLabelsFilterMode.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.FileSearchToolResourceResponseLanguage.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.FileSearchToolResourceType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.GetVectorStoreStudioV1DemosRegulationsVectorStoreVectorStoreIdGetResponse.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.GetVectorStoreStudioV1DemosRegulationsVectorStoreVectorStoreIdGetResponse.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolEndpoint.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolEndpoint.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolEndpointHeaders.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolEndpointHeaders.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolFunction.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolFunction.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolFunctionParamProperties.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolFunctionParamProperties.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolFunctionParameters.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolFunctionParameters.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolFunctionParametersProperties.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolFunctionParametersProperties.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolFunctionParametersType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolResource.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolResource.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.HTTPToolResourceType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.LanguageStudioApiServerDataTypesAssistantRequirement.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.LanguageStudioApiServerDataTypesAssistantRequirement.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.LanguageStudioApiServerDataTypesExecutionEngineRequirement.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.LanguageStudioApiServerDataTypesExecutionEngineRequirement.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPDefinition.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPDefinition.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPDefinitionHeaders.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPDefinitionHeaders.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPDiscoveryResponse.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPDiscoveryResponse.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPTool.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPTool.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPToolInputSchema.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPToolInputSchema.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPToolResource.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPToolResource.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPToolResourceHeaders.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPToolResourceHeaders.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.MCPToolResourceType.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ModifyAssistantRequest.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ModifyAssistantRequest.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ModifyAssistantRequestTool.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ModifyAssistantRequestTool.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.RunOptimization.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ToolResource.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ToolResource.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ToolsItem.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.ToolsItem.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.Visibility.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.WebSearchToolResource.Json.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.WebSearchToolResource.g.csis excluded by!**/generated/**src/libs/AI21/Generated/AI21.Models.WebSearchToolResourceType.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/AI21/openapi.yaml(20 hunks)
🔇 Additional comments (5)
src/libs/AI21/openapi.yaml (5)
1520-1541: Create Assistant: path looks fine; ensure schema consistency.CreateAssistantRequest currently differs from ModifyAssistantRequest/Assistant (optimization type, tool_resources ref, missing visibility). See suggested schema fixes below on Lines 2784–2824.
1590-1617: LGTM on PATCH route shape.Endpoint wiring and 200 return type are consistent with GET/DELETE.
1917-1939: Capitalize “MCP” in summary.Minor copy fix for consistency.
[raise_nitpick_refactor]
- summary: Mcp Tool Discovery + summary: MCP Tool Discovery
2871-2871: OK to reference execution_engine requirement.Consistent with new split requirement types.
3865-3905: ModifyAssistantRequest — looks consistent.Once CreateAssistantRequest is aligned, both will match.
| $ref: '#/components/schemas/AssistantToolResource' | ||
| requirements: | ||
| title: Requirements | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/language_studio_api_server__data_types__assistant__Requirement' | ||
| budget: | ||
| allOf: | ||
| - $ref: '#/components/schemas/BudgetLevel' | ||
| default: medium | ||
| visibility: | ||
| allOf: | ||
| - $ref: '#/components/schemas/Visibility' | ||
| default: public |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Assistant: new requirements/budget/visibility — OK; align optimization type.
- Good defaults for budget/visibility.
- Consider changing Assistant.optimization to RunOptimization for parity with ModifyAssistantRequest.
Proposed change (outside this hunk):
components:
schemas:
Assistant:
properties:
optimization:
- title: Optimization
- type: string
+ $ref: '#/components/schemas/RunOptimization'📝 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.
| $ref: '#/components/schemas/AssistantToolResource' | |
| requirements: | |
| title: Requirements | |
| type: array | |
| items: | |
| $ref: '#/components/schemas/language_studio_api_server__data_types__assistant__Requirement' | |
| budget: | |
| allOf: | |
| - $ref: '#/components/schemas/BudgetLevel' | |
| default: medium | |
| visibility: | |
| allOf: | |
| - $ref: '#/components/schemas/Visibility' | |
| default: public | |
| components: | |
| schemas: | |
| Assistant: | |
| properties: | |
| optimization: | |
| $ref: '#/components/schemas/RunOptimization' |
🤖 Prompt for AI Agents
In src/libs/AI21/openapi.yaml around lines 2106 to 2119, the Assistant schema
uses an optimization field type that should be aligned with
ModifyAssistantRequest; update the Assistant.optimization property to reference
the RunOptimization schema/type (the same one used by ModifyAssistantRequest) so
both APIs share the same type, and ensure any default/enum values and
documentation match RunOptimization's definition.
| title: BudgetLevel | ||
| enum: | ||
| - low | ||
| - medium | ||
| - high | ||
| description: An enumeration. |
There was a problem hiding this comment.
🛠️ Refactor suggestion
BudgetLevel enum added — good; reuse it.
Elsewhere (e.g., CreateMaestroRunsPayload.budget) a duplicate enum is inlined. Prefer referencing BudgetLevel.
🤖 Prompt for AI Agents
In src/libs/AI21/openapi.yaml around lines 2298-2303, the BudgetLevel enum is
defined but elsewhere (notably CreateMaestroRunsPayload.budget) the same enum is
duplicated inline; update those inlined definitions to reference the existing
BudgetLevel schema instead of redefining it (use a $ref to the BudgetLevel
component), ensuring the payload's budget property points to the shared enum
schema and remove the duplicated enum entries.
| title: CreateAssistantRequest | ||
| required: | ||
| - name | ||
| type: object | ||
| properties: | ||
| name: | ||
| title: Name | ||
| type: string | ||
| description: | ||
| title: Description | ||
| type: string | ||
| optimization: | ||
| title: Optimization | ||
| type: string | ||
| avatar: | ||
| title: Avatar | ||
| type: string | ||
| models: | ||
| title: Models | ||
| type: array | ||
| items: | ||
| type: string | ||
| tools: | ||
| title: Tools | ||
| type: array | ||
| items: | ||
| type: object | ||
| additionalProperties: | ||
| $ref: '#/components/schemas/AssistantTool' | ||
| tool_resources: | ||
| title: Tool Resources | ||
| type: object | ||
| requirements: | ||
| title: Requirements | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/language_studio_api_server__data_types__assistant__Requirement' | ||
| budget: | ||
| allOf: | ||
| - $ref: '#/components/schemas/BudgetLevel' | ||
| default: medium |
There was a problem hiding this comment.
CreateAssistantRequest: align with ModifyAssistantRequest/Assistant.
- Make optimization use RunOptimization.
- tool_resources should reference AssistantToolResource (not bare object).
- Add visibility property with default.
- Optional: make models allow UUIDs (match Assistant.anyOf) if intended.
CreateAssistantRequest:
title: CreateAssistantRequest
required:
- name
type: object
properties:
name:
title: Name
type: string
description:
title: Description
type: string
optimization:
- title: Optimization
- type: string
+ $ref: '#/components/schemas/RunOptimization'
avatar:
title: Avatar
type: string
models:
title: Models
type: array
items:
type: string
tools:
title: Tools
type: array
items:
type: object
additionalProperties:
$ref: '#/components/schemas/AssistantTool'
- tool_resources:
- title: Tool Resources
- type: object
+ tool_resources:
+ $ref: '#/components/schemas/AssistantToolResource'
requirements:
title: Requirements
type: array
items:
$ref: '#/components/schemas/language_studio_api_server__data_types__assistant__Requirement'
budget:
allOf:
- $ref: '#/components/schemas/BudgetLevel'
default: medium
+ visibility:
+ allOf:
+ - $ref: '#/components/schemas/Visibility'
+ default: public📝 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.
| title: CreateAssistantRequest | |
| required: | |
| - name | |
| type: object | |
| properties: | |
| name: | |
| title: Name | |
| type: string | |
| description: | |
| title: Description | |
| type: string | |
| optimization: | |
| title: Optimization | |
| type: string | |
| avatar: | |
| title: Avatar | |
| type: string | |
| models: | |
| title: Models | |
| type: array | |
| items: | |
| type: string | |
| tools: | |
| title: Tools | |
| type: array | |
| items: | |
| type: object | |
| additionalProperties: | |
| $ref: '#/components/schemas/AssistantTool' | |
| tool_resources: | |
| title: Tool Resources | |
| type: object | |
| requirements: | |
| title: Requirements | |
| type: array | |
| items: | |
| $ref: '#/components/schemas/language_studio_api_server__data_types__assistant__Requirement' | |
| budget: | |
| allOf: | |
| - $ref: '#/components/schemas/BudgetLevel' | |
| default: medium | |
| title: CreateAssistantRequest | |
| required: | |
| - name | |
| type: object | |
| properties: | |
| name: | |
| title: Name | |
| type: string | |
| description: | |
| title: Description | |
| type: string | |
| optimization: | |
| $ref: '#/components/schemas/RunOptimization' | |
| avatar: | |
| title: Avatar | |
| type: string | |
| models: | |
| title: Models | |
| type: array | |
| items: | |
| type: string | |
| tools: | |
| title: Tools | |
| type: array | |
| items: | |
| type: object | |
| additionalProperties: | |
| $ref: '#/components/schemas/AssistantTool' | |
| tool_resources: | |
| $ref: '#/components/schemas/AssistantToolResource' | |
| requirements: | |
| title: Requirements | |
| type: array | |
| items: | |
| $ref: '#/components/schemas/language_studio_api_server__data_types__assistant__Requirement' | |
| budget: | |
| allOf: | |
| - $ref: '#/components/schemas/BudgetLevel' | |
| default: medium | |
| visibility: | |
| allOf: | |
| - $ref: '#/components/schemas/Visibility' | |
| default: public |
🤖 Prompt for AI Agents
In src/libs/AI21/openapi.yaml around lines 2784-2824, Update
CreateAssistantRequest so optimization is typed as RunOptimization (use $ref
'#/components/schemas/RunOptimization'), change tool_resources from a bare
object to reference AssistantToolResource ($ref
'#/components/schemas/AssistantToolResource'), add a visibility property (type:
string) with a sensible default (e.g., "private") and include it in the schema,
and optionally update models.items to allow UUIDs as well (e.g., use anyOf to
accept a plain string or a UUID schema reference to match Assistant.anyOf).
| oneOf: | ||
| - $ref: '#/components/schemas/HTTPToolResource' | ||
| - $ref: '#/components/schemas/MCPToolResource' | ||
| - $ref: '#/components/schemas/FileSearchToolResource' | ||
| - $ref: '#/components/schemas/WebSearchToolResource' | ||
| discriminator: | ||
| propertyName: type | ||
| mapping: | ||
| http: '#/components/schemas/HTTPToolResource' | ||
| mcp: '#/components/schemas/MCPToolResource' | ||
| file_search: '#/components/schemas/FileSearchToolResource' | ||
| web_search: '#/components/schemas/WebSearchToolResource' | ||
| tool_resources: | ||
| $ref: '#/components/schemas/ToolResources' | ||
| $ref: '#/components/schemas/ToolResource' | ||
| context: |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Discriminated union for tools — good; ensure ‘type’ is required.
The discriminator relies on a present ‘type’. Add ‘type’ to required arrays of each resource schema.
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="src/libs/AI21/openapi.yaml"
if [ ! -f "$FILE" ]; then
echo "ERROR: $FILE not found in repository root."
echo "Searching for any openapi.yaml files..."
rg -n --hidden --no-ignore "openapi.yaml" || true
exit 0
fi
python3 - <<'PY'
import sys, json, subprocess
fn="src/libs/AI21/openapi.yaml"
try:
import yaml
except Exception:
subprocess.check_call([sys.executable, "-m", "pip", "install", "PyYAML"], stdout=subprocess.DEVNULL)
import yaml
with open(fn, 'r') as f:
doc = yaml.safe_load(f)
components = doc.get('components', {})
schemas = components.get('schemas', {})
target_names = ["HTTPToolResource","MCPToolResource","FileSearchToolResource","WebSearchToolResource","ToolResource"]
out = {"found_file": fn, "checked_schemas": {}}
for name in target_names:
sch = schemas.get(name)
if sch is None:
out["checked_schemas"][name] = {"exists": False}
else:
req = sch.get('required')
props = sch.get('properties', {})
type_prop = props.get('type')
out["checked_schemas"][name] = {
"exists": True,
"required": req,
"has_type_property": ('type' in props),
"type_property": type_prop
}
# find schemas that include a discriminator
discriminators = {}
for sname, sdef in schemas.items():
if isinstance(sdef, dict) and 'discriminator' in sdef:
discriminators[sname] = {
"discriminator": sdef.get('discriminator'),
"oneOf": sdef.get('oneOf')
}
out["schemas_with_discriminator"] = discriminators
print(json.dumps(out, indent=2))
PYLength of output: 1448
Discriminated union for tools — make 'type' required on each concrete resource schema
- Add "type" to the required arrays of components.schemas.HTTPToolResource, MCPToolResource, FileSearchToolResource, and WebSearchToolResource in src/libs/AI21/openapi.yaml (each defines a "type" property but it's not listed as required).
- components.schemas.ToolResource has no "type" property; either add a required "type" there or ensure ToolResource is only a oneOf wrapper and the discriminator is declared at the union level.
🤖 Prompt for AI Agents
In src/libs/AI21/openapi.yaml around lines 2850-2864, the concrete tool schemas
used by the discriminated union declare a "type" property but do not list it as
required, and components.schemas.ToolResource lacks a "type" definition; update
each concrete schema (components.schemas.HTTPToolResource, MCPToolResource,
FileSearchToolResource, WebSearchToolResource) to include "type" in their
required arrays so the discriminator is enforced, and then either (A) keep
ToolResource as a pure oneOf wrapper (remove any "type" from ToolResource and
ensure the discriminator is declared at the union level only), or (B) if
ToolResource must include a type, add a "type" property to ToolResource and mark
it required there as well—pick one approach and apply consistently so the
discriminator mapping and required properties align.
| title: RunOptimization | ||
| enum: | ||
| - cost | ||
| - latency | ||
| description: An enumeration. | ||
| SecretResponse: |
There was a problem hiding this comment.
🛠️ Refactor suggestion
RunOptimization enum — good addition.
Recommend referencing this in Assistant and CreateAssistantRequest (see suggestions).
🤖 Prompt for AI Agents
In src/libs/AI21/openapi.yaml around lines 4064 to 4069, the new RunOptimization
enum is defined but not referenced from the Assistant and CreateAssistantRequest
schemas; update those two schemas to use the RunOptimization enum by adding a
$ref to '#/components/schemas/RunOptimization' (or set the property type to that
enum) where the optimization setting/property belongs so the models reference
the shared enum instead of duplicating values; ensure required/nullable
semantics match existing usage and regenerate any clients/docs if applicable.
| title: ToolResource | ||
| type: object | ||
| properties: | ||
| file_search: | ||
| title: File Search | ||
| type: object | ||
| $ref: '#/components/schemas/FileSearchToolResource' | ||
| web_search: | ||
| title: Web Search | ||
| type: object | ||
| $ref: '#/components/schemas/WebSearchToolResource' | ||
| TopLogprobsData: |
There was a problem hiding this comment.
🛠️ Refactor suggestion
ToolResource missing http/mcp branches.
Tools union allows http/mcp, but ToolResource only has file_search/web_search. Add http and mcp for symmetry.
ToolResource:
title: ToolResource
type: object
properties:
file_search:
$ref: '#/components/schemas/FileSearchToolResource'
web_search:
$ref: '#/components/schemas/WebSearchToolResource'
+ http:
+ $ref: '#/components/schemas/HTTPToolResource'
+ mcp:
+ $ref: '#/components/schemas/MCPToolResource'📝 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.
| title: ToolResource | |
| type: object | |
| properties: | |
| file_search: | |
| title: File Search | |
| type: object | |
| $ref: '#/components/schemas/FileSearchToolResource' | |
| web_search: | |
| title: Web Search | |
| type: object | |
| $ref: '#/components/schemas/WebSearchToolResource' | |
| TopLogprobsData: | |
| title: ToolResource | |
| type: object | |
| properties: | |
| file_search: | |
| $ref: '#/components/schemas/FileSearchToolResource' | |
| web_search: | |
| $ref: '#/components/schemas/WebSearchToolResource' | |
| http: | |
| $ref: '#/components/schemas/HTTPToolResource' | |
| mcp: | |
| $ref: '#/components/schemas/MCPToolResource' | |
| TopLogprobsData: |
🤖 Prompt for AI Agents
In src/libs/AI21/openapi.yaml around lines 4258 to 4265, the ToolResource object
only defines file_search and web_search but the tools union also permits http
and mcp; add properties for http and mcp to ToolResource using $ref entries
(e.g. $ref: '#/components/schemas/HttpToolResource' and $ref:
'#/components/schemas/McpToolResource') so the schema matches the allowed tool
types, and if those component schemas do not exist create them under
components/schemas with the expected structure.
Summary by CodeRabbit
New Features
Enhancements