first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:52:23 +03:00
commit 880f412e2c
2662 changed files with 866266 additions and 0 deletions

View File

@@ -0,0 +1,364 @@
# Cohere v2 Chat API Schemas
CohereChatRequest:
type: object
required:
- model
- messages
properties:
model:
type: string
description: Model to use for chat completion
example: command-r-plus
messages:
type: array
items:
$ref: '#/CohereMessage'
description: Array of message objects
tools:
type: array
items:
$ref: '#/CohereTool'
tool_choice:
$ref: '#/CohereToolChoice'
temperature:
type: number
minimum: 0
maximum: 1
p:
type: number
description: Top-p sampling
k:
type: integer
description: Top-k sampling
max_tokens:
type: integer
stop_sequences:
type: array
items:
type: string
frequency_penalty:
type: number
presence_penalty:
type: number
stream:
type: boolean
safety_mode:
type: string
enum: [CONTEXTUAL, STRICT, NONE]
log_probs:
type: boolean
strict_tool_choice:
type: boolean
thinking:
$ref: '#/CohereThinking'
response_format:
$ref: '#/CohereResponseFormat'
CohereMessage:
type: object
required:
- role
properties:
role:
type: string
enum: [system, user, assistant, tool]
content:
$ref: '#/CohereMessageContent'
tool_calls:
type: array
items:
$ref: '#/CohereToolCall'
tool_call_id:
type: string
tool_plan:
type: string
description: Chain-of-thought style reflection (assistant only)
CohereMessageContent:
oneOf:
- type: string
- type: array
items:
$ref: '#/CohereContentBlock'
description: Message content - can be a string or array of content blocks
CohereContentBlock:
type: object
required:
- type
properties:
type:
type: string
enum: [text, image_url, thinking, document]
text:
type: string
image_url:
type: object
properties:
url:
type: string
thinking:
type: string
document:
type: object
properties:
data:
type: object
id:
type: string
CohereTool:
type: object
properties:
type:
type: string
enum: [function]
function:
type: object
properties:
name:
type: string
description:
type: string
parameters:
type: object
CohereToolChoice:
type: string
enum: [AUTO, NONE, REQUIRED]
description: Tool choice mode - AUTO lets the model decide, NONE disables tools, REQUIRED forces tool use
CohereToolCall:
type: object
properties:
id:
type: string
type:
type: string
enum: [function]
function:
type: object
properties:
name:
type: string
arguments:
type: string
CohereThinking:
type: object
properties:
type:
type: string
enum: [enabled, disabled]
token_budget:
type: integer
minimum: 1
CohereResponseFormat:
type: object
properties:
type:
type: string
enum: [text, json_object]
description: Response format type
schema:
type: object
description: JSON schema for structured output (used with json_object type)
# Response types
CohereChatResponse:
type: object
properties:
id:
type: string
finish_reason:
type: string
enum: [COMPLETE, STOP_SEQUENCE, MAX_TOKENS, TOOL_CALL, ERROR, TIMEOUT]
message:
type: object
properties:
role:
type: string
content:
type: array
items:
$ref: '#/CohereContentBlock'
tool_calls:
type: array
items:
$ref: '#/CohereToolCall'
tool_plan:
type: string
usage:
$ref: '#/CohereUsage'
logprobs:
type: array
items:
$ref: '#/CohereLogProb'
description: Log probabilities (if requested)
CohereUsage:
type: object
properties:
billed_units:
$ref: '#/CohereBilledUnits'
tokens:
$ref: '#/CohereTokenUsage'
cached_tokens:
type: integer
description: Cached tokens
CohereBilledUnits:
type: object
properties:
input_tokens:
type: integer
description: Number of billed input tokens
output_tokens:
type: integer
description: Number of billed output tokens
search_units:
type: integer
description: Number of billed search units
classifications:
type: integer
description: Number of billed classification units
CohereTokenUsage:
type: object
properties:
input_tokens:
type: integer
description: Number of input tokens used
output_tokens:
type: integer
description: Number of output tokens produced
CohereLogProb:
type: object
properties:
token_ids:
type: array
items:
type: integer
description: Token IDs of each token in text chunk
text:
type: string
description: Text chunk for log probabilities
logprobs:
type: array
items:
type: number
description: Log probability of each token
# Stream event types
CohereChatStreamEvent:
type: object
properties:
type:
type: string
enum: [message-start, content-start, content-delta, content-end, tool-plan-delta, tool-call-start, tool-call-delta, tool-call-end, citation-start, citation-end, message-end, debug]
description: Type of streaming event
id:
type: string
description: Event ID (for message-start)
index:
type: integer
description: Index for indexed events
delta:
$ref: '#/CohereStreamDelta'
CohereStreamDelta:
type: object
properties:
message:
$ref: '#/CohereStreamMessage'
finish_reason:
type: string
enum: [COMPLETE, STOP_SEQUENCE, MAX_TOKENS, TOOL_CALL, ERROR, TIMEOUT]
usage:
$ref: '#/CohereUsage'
CohereStreamMessage:
type: object
properties:
role:
type: string
description: Message role (for message-start)
content:
oneOf:
- $ref: '#/CohereStreamContent'
- type: array
items:
$ref: '#/CohereStreamContent'
description: Content for content events
tool_plan:
type: string
description: Tool plan content (for tool-plan-delta)
tool_calls:
oneOf:
- $ref: '#/CohereToolCall'
- type: array
items:
$ref: '#/CohereToolCall'
description: Tool calls (for tool-call events)
citations:
oneOf:
- $ref: '#/CohereCitation'
- type: array
items:
$ref: '#/CohereCitation'
description: Citations (for citation events)
CohereStreamContent:
type: object
properties:
type:
type: string
enum: [text, image_url, thinking, document]
text:
type: string
thinking:
type: string
CohereCitation:
type: object
properties:
start:
type: integer
description: Start position of cited text
end:
type: integer
description: End position of cited text
text:
type: string
description: Cited text
sources:
type: array
items:
$ref: '#/CohereSource'
content_index:
type: integer
description: Content index of the citation
type:
type: string
enum: [TEXT_CONTENT, THINKING_CONTENT, PLAN]
description: Type of citation
CohereSource:
type: object
properties:
type:
type: string
enum: [tool, document]
description: Source type
id:
type: string
description: Source ID (nullable)
tool_output:
type: object
description: Tool output (for tool sources)
document:
type: object
description: Document data (for document sources)

View File

@@ -0,0 +1,14 @@
# Cohere Integration Common Types
CohereError:
type: object
properties:
type:
type: string
description: Error type
message:
type: string
description: Error message
code:
type: string
description: Optional error code

View File

@@ -0,0 +1,172 @@
# Cohere v2 Embed API Schemas
CohereEmbeddingRequest:
type: object
required:
- model
- input_type
properties:
model:
type: string
description: ID of an available embedding model
example: embed-english-v3.0
input_type:
type: string
description: Specifies the type of input passed to the model. Required for embedding models v3 and higher.
texts:
type: array
items:
type: string
description: Array of strings to embed. Maximum 96 texts per call. At least one of texts, images, or inputs is required.
maxItems: 96
images:
type: array
items:
type: string
description: Array of image data URIs for multimodal embedding. Maximum 1 image per call. Supports JPEG, PNG, WebP, GIF up to 5MB.
maxItems: 1
inputs:
type: array
items:
$ref: '#/CohereEmbeddingInput'
description: Array of mixed text/image components for embedding. Maximum 96 per call.
maxItems: 96
embedding_types:
type: array
items:
type: string
description: Specifies the return format types (float, int8, uint8, binary, ubinary, base64). Defaults to float if unspecified.
output_dimension:
type: integer
description: Number of dimensions for output embeddings (256, 512, 1024, 1536). Available only for embed-v4 and newer models.
max_tokens:
type: integer
description: Maximum tokens to embed per input before truncation.
truncate:
type: string
description: Handling for inputs exceeding token limits. Defaults to END.
CohereEmbeddingInput:
type: object
properties:
content:
type: array
items:
$ref: './chat.yaml#/CohereContentBlock'
description: Array of content blocks (reuses chat content blocks)
CohereEmbeddingResponse:
type: object
properties:
id:
type: string
description: Response ID
embeddings:
$ref: '#/CohereEmbeddingData'
response_type:
type: string
description: Response type (embeddings_floats, embeddings_by_type)
texts:
type: array
items:
type: string
description: Original text entries
images:
type: array
items:
$ref: '#/CohereEmbeddingImageInfo'
description: Original image entries
meta:
$ref: '#/CohereEmbeddingMeta'
CohereEmbeddingData:
type: object
description: Embedding data object with different types
properties:
float:
type: array
items:
type: array
items:
type: number
description: Float embeddings
int8:
type: array
items:
type: array
items:
type: integer
description: Int8 embeddings
uint8:
type: array
items:
type: array
items:
type: integer
description: Uint8 embeddings
binary:
type: array
items:
type: array
items:
type: integer
description: Binary embeddings
ubinary:
type: array
items:
type: array
items:
type: integer
description: Unsigned binary embeddings
base64:
type: array
items:
type: string
description: Base64-encoded embeddings
CohereEmbeddingImageInfo:
type: object
description: Image information in the response
properties:
width:
type: integer
description: Width in pixels
height:
type: integer
description: Height in pixels
format:
type: string
description: Image format
bit_depth:
type: integer
description: Bit depth
CohereEmbeddingMeta:
type: object
description: Metadata in embedding response
properties:
api_version:
$ref: '#/CohereEmbeddingAPIVersion'
billed_units:
$ref: './chat.yaml#/CohereBilledUnits'
tokens:
$ref: './chat.yaml#/CohereTokenUsage'
warnings:
type: array
items:
type: string
description: Any warnings
CohereEmbeddingAPIVersion:
type: object
description: API version information
properties:
version:
type: string
description: API version
is_deprecated:
type: boolean
description: Deprecation status
is_experimental:
type: boolean
description: Experimental status

View File

@@ -0,0 +1,48 @@
# Cohere Tokenize API Schemas
CohereCountTokensRequest:
type: object
required:
- text
- model
properties:
model:
type: string
description: Model whose tokenizer should be used
example: command-r-plus
text:
type: string
description: Text to tokenize (1-65536 characters)
minLength: 1
maxLength: 65536
CohereCountTokensResponse:
type: object
properties:
tokens:
type: array
items:
type: integer
description: Token IDs
token_strings:
type: array
items:
type: string
description: Token strings
meta:
$ref: '#/CohereTokenizeMeta'
CohereTokenizeMeta:
type: object
description: Metadata returned by the tokenize endpoint
properties:
api_version:
$ref: '#/CohereTokenizeAPIVersion'
CohereTokenizeAPIVersion:
type: object
description: API version metadata
properties:
version:
type: string
description: API version