-
-
Notifications
You must be signed in to change notification settings - Fork 2
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 Anthropic API OpenAPI specification from 3.0.1 to 3.0.4 #98
Conversation
WalkthroughThe pull request updates the Anthropic API's OpenAPI specification from version 3.0.1 to 3.0.4. The changes introduce new endpoints for token counting, message batching, and batch management. The specification now supports beta features through the Changes
Sequence DiagramsequenceDiagram
participant Client
participant AnthropicAPI
Client->>AnthropicAPI: POST /v1/messages/batches
AnthropicAPI-->>Client: Create Message Batch
Client->>AnthropicAPI: GET /v1/messages/batches/{batch_id}/results
AnthropicAPI-->>Client: Retrieve Batch Results
Client->>AnthropicAPI: POST /v1/messages/count_tokens
AnthropicAPI-->>Client: Return Token Count
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (2)
src/libs/Anthropic/openapi.yaml (2)
Line range hint
8-24
: Authentication header requirements need to be explicitly documentedThe
/v1/messages
endpoint should explicitly document the requiredx-api-key
header parameter for authentication, similar to how it's done in other endpoints.Add the following parameter to the endpoint:
parameters: - name: x-api-key in: header required: true description: "Your unique API key for authentication." schema: type: string
Based on the analysis of the OpenAPI specification and the generated code, I can now provide the final response:
Rate limiting headers should be documented in the API specification
The API implements rate limiting functionality (evidenced by RateLimitError types and usage documentation), but the rate limit headers are not documented in the OpenAPI specification. This is important for clients to properly handle rate limiting.
- Add the following headers to all response objects in the OpenAPI spec:
headers: x-ratelimit-limit: description: The maximum number of requests allowed per hour schema: type: integer x-ratelimit-remaining: description: The number of requests remaining in the current time window schema: type: integer x-ratelimit-reset: description: The time at which the rate limit will reset, in Unix epoch seconds schema: type: integer🔗 Analysis chain
Line range hint
32-38
: Verify rate limiting headers in responsesThe API responses should include rate limiting headers to help clients manage their API usage.
Consider adding the following headers to all response objects:
headers: x-ratelimit-limit: description: The maximum number of requests allowed per hour schema: type: integer x-ratelimit-remaining: description: The number of requests remaining in the current time window schema: type: integer x-ratelimit-reset: description: The time at which the rate limit will reset, in Unix epoch seconds schema: type: integer
Let me verify if there are any other rate-limiting related headers or documentation in the OpenAPI spec.
Let me check the OpenAPI spec directly to see if there are any response headers defined.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if rate limiting headers are documented in the responses rg -A 5 "x-ratelimit" || echo "No rate limit headers found in the specification"Length of output: 128
Script:
#!/bin/bash # Check for any rate limit related documentation in the OpenAPI spec rg -i "rate.?limit" -A 5 || echo "No rate limiting documentation found" # Also check for specific response headers documentation rg -i "headers:" -A 10 || echo "No response headers documentation found"Length of output: 66655
Script:
#!/bin/bash # Check the OpenAPI spec for response headers cat src/libs/Anthropic/openapi.yaml | grep -A 10 "responses:" || echo "No responses section found"Length of output: 8534
🧹 Nitpick comments (3)
src/libs/Anthropic/openapi.yaml (3)
Line range hint
5-7
: Consider adding API version to the server URLWhile the base URL is correctly specified, consider versioning the API endpoint URL pattern to support multiple API versions in the future.
servers: - - url: https://api.anthropic.com + - url: https://api.anthropic.com/v1 + description: Production v1 server
Line range hint
1024-1089
: Beta feature handling needs improvementThe beta feature handling through the
anthropic-beta
header is well-structured, but there are a few improvements needed:
- The beta versions should include expiration dates in their descriptions
- The error handling for invalid beta versions should be explicitly documented
Update the AnthropicBeta schema:
AnthropicBeta: anyOf: - type: string - enum: - message-batches-2024-09-24 - prompt-caching-2024-07-31 - computer-use-2024-10-22 - pdfs-2024-09-25 - token-counting-2024-11-01 type: string description: | Beta feature identifiers. Format: feature-name-YYYY-MM-DD Each beta has an expiration date after which it will be either promoted to stable or discontinued.
Line range hint
2051-2089
: Model versioning strategy needs clarificationThe model versioning schema is well-structured but could benefit from additional documentation around version lifecycle and deprecation policy.
Add lifecycle information to the Model schema:
Model: description: | The model that will complete your prompt. Model versions follow the format: name-version-YYYYMMDD Models marked as 'latest' automatically use the most recent version. Specific version models are frozen and will be supported for at least 6 months after a newer version is released. See [models](https://docs.anthropic.com/en/docs/models-overview) for details.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/libs/Anthropic/openapi.yaml
(1 hunks)
🔇 Additional comments (1)
src/libs/Anthropic/openapi.yaml (1)
1-1
: OpenAPI specification version upgrade looks good
The upgrade from OpenAPI 3.0.1 to 3.0.4 is appropriate and brings in the latest stable specification features.
Summary by CodeRabbit
New Features
anthropic-beta
header.Improvements