├── .fernignore ├── .github └── workflows │ ├── ci.yml │ └── test.yml ├── .gitignore ├── .npmignore ├── .prettierrc.yml ├── LICENSE ├── README.md ├── banner.png ├── jest.config.js ├── package.json ├── reference.md ├── src ├── AwsClient.ts ├── BedrockClient.ts ├── Client.ts ├── ClientV2.ts ├── CustomClient.ts ├── SagemakerClient.ts ├── api │ ├── client │ │ ├── index.ts │ │ └── requests │ │ │ ├── ChatRequest.ts │ │ │ ├── ChatStreamRequest.ts │ │ │ ├── ClassifyRequest.ts │ │ │ ├── DetokenizeRequest.ts │ │ │ ├── EmbedRequest.ts │ │ │ ├── GenerateRequest.ts │ │ │ ├── GenerateStreamRequest.ts │ │ │ ├── RerankRequest.ts │ │ │ ├── SummarizeRequest.ts │ │ │ ├── TokenizeRequest.ts │ │ │ └── index.ts │ ├── errors │ │ ├── BadRequestError.ts │ │ ├── ClientClosedRequestError.ts │ │ ├── ForbiddenError.ts │ │ ├── GatewayTimeoutError.ts │ │ ├── InternalServerError.ts │ │ ├── InvalidTokenError.ts │ │ ├── NotFoundError.ts │ │ ├── NotImplementedError.ts │ │ ├── ServiceUnavailableError.ts │ │ ├── TooManyRequestsError.ts │ │ ├── UnauthorizedError.ts │ │ ├── UnprocessableEntityError.ts │ │ └── index.ts │ ├── index.ts │ ├── resources │ │ ├── connectors │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── ConnectorsListRequest.ts │ │ │ │ │ ├── ConnectorsOAuthAuthorizeRequest.ts │ │ │ │ │ ├── CreateConnectorRequest.ts │ │ │ │ │ ├── UpdateConnectorRequest.ts │ │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── datasets │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── DatasetsCreateRequest.ts │ │ │ │ │ ├── DatasetsListRequest.ts │ │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── types │ │ │ │ ├── DatasetsCreateResponse.ts │ │ │ │ ├── DatasetsCreateResponseDatasetPartsItem.ts │ │ │ │ ├── DatasetsGetResponse.ts │ │ │ │ ├── DatasetsGetUsageResponse.ts │ │ │ │ ├── DatasetsListResponse.ts │ │ │ │ └── index.ts │ │ ├── embedJobs │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── CreateEmbedJobRequest.ts │ │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── types │ │ │ │ ├── CreateEmbedJobRequestTruncate.ts │ │ │ │ └── index.ts │ │ ├── finetuning │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── FinetuningListEventsRequest.ts │ │ │ │ │ ├── FinetuningListFinetunedModelsRequest.ts │ │ │ │ │ ├── FinetuningListTrainingStepMetricsRequest.ts │ │ │ │ │ ├── FinetuningUpdateFinetunedModelRequest.ts │ │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── resources │ │ │ │ ├── finetuning │ │ │ │ ├── index.ts │ │ │ │ └── types │ │ │ │ │ ├── BaseModel.ts │ │ │ │ │ ├── BaseType.ts │ │ │ │ │ ├── CreateFinetunedModelResponse.ts │ │ │ │ │ ├── DeleteFinetunedModelResponse.ts │ │ │ │ │ ├── Event.ts │ │ │ │ │ ├── FinetunedModel.ts │ │ │ │ │ ├── GetFinetunedModelResponse.ts │ │ │ │ │ ├── Hyperparameters.ts │ │ │ │ │ ├── ListEventsResponse.ts │ │ │ │ │ ├── ListFinetunedModelsResponse.ts │ │ │ │ │ ├── ListTrainingStepMetricsResponse.ts │ │ │ │ │ ├── LoraTargetModules.ts │ │ │ │ │ ├── Settings.ts │ │ │ │ │ ├── Status.ts │ │ │ │ │ ├── Strategy.ts │ │ │ │ │ ├── TrainingStepMetrics.ts │ │ │ │ │ ├── UpdateFinetunedModelResponse.ts │ │ │ │ │ ├── WandbConfig.ts │ │ │ │ │ └── index.ts │ │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── models │ │ │ ├── client │ │ │ │ ├── Client.ts │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── ModelsListRequest.ts │ │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ └── v2 │ │ │ ├── client │ │ │ ├── Client.ts │ │ │ ├── index.ts │ │ │ └── requests │ │ │ │ ├── V2ChatRequest.ts │ │ │ │ ├── V2ChatStreamRequest.ts │ │ │ │ ├── V2EmbedRequest.ts │ │ │ │ ├── V2RerankRequest.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── types │ │ │ ├── V2ChatRequestDocumentsItem.ts │ │ │ ├── V2ChatRequestSafetyMode.ts │ │ │ ├── V2ChatRequestToolChoice.ts │ │ │ ├── V2ChatStreamRequestDocumentsItem.ts │ │ │ ├── V2ChatStreamRequestSafetyMode.ts │ │ │ ├── V2ChatStreamRequestToolChoice.ts │ │ │ ├── V2EmbedRequestTruncate.ts │ │ │ ├── V2RerankResponse.ts │ │ │ ├── V2RerankResponseResultsItem.ts │ │ │ ├── V2RerankResponseResultsItemDocument.ts │ │ │ └── index.ts │ └── types │ │ ├── ApiMeta.ts │ │ ├── ApiMetaApiVersion.ts │ │ ├── ApiMetaBilledUnits.ts │ │ ├── ApiMetaTokens.ts │ │ ├── AssistantMessage.ts │ │ ├── AssistantMessageContent.ts │ │ ├── AssistantMessageContentItem.ts │ │ ├── AssistantMessageResponse.ts │ │ ├── AssistantMessageResponseContentItem.ts │ │ ├── AuthTokenType.ts │ │ ├── ChatCitation.ts │ │ ├── ChatCitationGenerationEvent.ts │ │ ├── ChatCitationType.ts │ │ ├── ChatConnector.ts │ │ ├── ChatContentDeltaEvent.ts │ │ ├── ChatContentDeltaEventDelta.ts │ │ ├── ChatContentDeltaEventDeltaMessage.ts │ │ ├── ChatContentDeltaEventDeltaMessageContent.ts │ │ ├── ChatContentEndEvent.ts │ │ ├── ChatContentStartEvent.ts │ │ ├── ChatContentStartEventDelta.ts │ │ ├── ChatContentStartEventDeltaMessage.ts │ │ ├── ChatContentStartEventDeltaMessageContent.ts │ │ ├── ChatDataMetrics.ts │ │ ├── ChatDebugEvent.ts │ │ ├── ChatDocument.ts │ │ ├── ChatFinishReason.ts │ │ ├── ChatMessage.ts │ │ ├── ChatMessageEndEvent.ts │ │ ├── ChatMessageEndEventDelta.ts │ │ ├── ChatMessageStartEvent.ts │ │ ├── ChatMessageStartEventDelta.ts │ │ ├── ChatMessageStartEventDeltaMessage.ts │ │ ├── ChatMessageV2.ts │ │ ├── ChatMessages.ts │ │ ├── ChatRequestCitationQuality.ts │ │ ├── ChatRequestConnectorsSearchOptions.ts │ │ ├── ChatRequestPromptTruncation.ts │ │ ├── ChatRequestSafetyMode.ts │ │ ├── ChatResponse.ts │ │ ├── ChatSearchQueriesGenerationEvent.ts │ │ ├── ChatSearchQuery.ts │ │ ├── ChatSearchResult.ts │ │ ├── ChatSearchResultConnector.ts │ │ ├── ChatSearchResultsEvent.ts │ │ ├── ChatStreamEndEvent.ts │ │ ├── ChatStreamEndEventFinishReason.ts │ │ ├── ChatStreamEvent.ts │ │ ├── ChatStreamEventType.ts │ │ ├── ChatStreamRequestCitationQuality.ts │ │ ├── ChatStreamRequestConnectorsSearchOptions.ts │ │ ├── ChatStreamRequestPromptTruncation.ts │ │ ├── ChatStreamRequestSafetyMode.ts │ │ ├── ChatStreamStartEvent.ts │ │ ├── ChatTextGenerationEvent.ts │ │ ├── ChatToolCallDeltaEvent.ts │ │ ├── ChatToolCallDeltaEventDelta.ts │ │ ├── ChatToolCallDeltaEventDeltaMessage.ts │ │ ├── ChatToolCallDeltaEventDeltaMessageToolCalls.ts │ │ ├── ChatToolCallDeltaEventDeltaMessageToolCallsFunction.ts │ │ ├── ChatToolCallEndEvent.ts │ │ ├── ChatToolCallStartEvent.ts │ │ ├── ChatToolCallStartEventDelta.ts │ │ ├── ChatToolCallStartEventDeltaMessage.ts │ │ ├── ChatToolCallsChunkEvent.ts │ │ ├── ChatToolCallsGenerationEvent.ts │ │ ├── ChatToolPlanDeltaEvent.ts │ │ ├── ChatToolPlanDeltaEventDelta.ts │ │ ├── ChatToolPlanDeltaEventDeltaMessage.ts │ │ ├── CheckApiKeyResponse.ts │ │ ├── Citation.ts │ │ ├── CitationEndEvent.ts │ │ ├── CitationOptions.ts │ │ ├── CitationOptionsMode.ts │ │ ├── CitationStartEvent.ts │ │ ├── CitationStartEventDelta.ts │ │ ├── CitationStartEventDeltaMessage.ts │ │ ├── CitationType.ts │ │ ├── ClassifyDataMetrics.ts │ │ ├── ClassifyExample.ts │ │ ├── ClassifyRequestTruncate.ts │ │ ├── ClassifyResponse.ts │ │ ├── ClassifyResponseClassificationsItem.ts │ │ ├── ClassifyResponseClassificationsItemClassificationType.ts │ │ ├── ClassifyResponseClassificationsItemLabelsValue.ts │ │ ├── CompatibleEndpoint.ts │ │ ├── Connector.ts │ │ ├── ConnectorAuthStatus.ts │ │ ├── ConnectorOAuth.ts │ │ ├── Content.ts │ │ ├── CreateConnectorOAuth.ts │ │ ├── CreateConnectorResponse.ts │ │ ├── CreateConnectorServiceAuth.ts │ │ ├── CreateEmbedJobResponse.ts │ │ ├── Dataset.ts │ │ ├── DatasetPart.ts │ │ ├── DatasetType.ts │ │ ├── DatasetValidationStatus.ts │ │ ├── DeleteConnectorResponse.ts │ │ ├── DetokenizeResponse.ts │ │ ├── Document.ts │ │ ├── DocumentContent.ts │ │ ├── DocumentSource.ts │ │ ├── EmbedByTypeResponse.ts │ │ ├── EmbedByTypeResponseEmbeddings.ts │ │ ├── EmbedContent.ts │ │ ├── EmbedFloatsResponse.ts │ │ ├── EmbedImage.ts │ │ ├── EmbedImageUrl.ts │ │ ├── EmbedInput.ts │ │ ├── EmbedInputType.ts │ │ ├── EmbedJob.ts │ │ ├── EmbedJobStatus.ts │ │ ├── EmbedJobTruncate.ts │ │ ├── EmbedRequestTruncate.ts │ │ ├── EmbedResponse.ts │ │ ├── EmbedText.ts │ │ ├── EmbeddingType.ts │ │ ├── FinetuneDatasetMetrics.ts │ │ ├── FinishReason.ts │ │ ├── GenerateRequestReturnLikelihoods.ts │ │ ├── GenerateRequestTruncate.ts │ │ ├── GenerateStreamEnd.ts │ │ ├── GenerateStreamEndResponse.ts │ │ ├── GenerateStreamError.ts │ │ ├── GenerateStreamEvent.ts │ │ ├── GenerateStreamRequestReturnLikelihoods.ts │ │ ├── GenerateStreamRequestTruncate.ts │ │ ├── GenerateStreamText.ts │ │ ├── GenerateStreamedResponse.ts │ │ ├── Generation.ts │ │ ├── GetConnectorResponse.ts │ │ ├── GetModelResponse.ts │ │ ├── Image.ts │ │ ├── ImageContent.ts │ │ ├── ImageUrl.ts │ │ ├── JsonResponseFormat.ts │ │ ├── JsonResponseFormatV2.ts │ │ ├── LabelMetric.ts │ │ ├── ListConnectorsResponse.ts │ │ ├── ListEmbedJobResponse.ts │ │ ├── ListModelsResponse.ts │ │ ├── LogprobItem.ts │ │ ├── Message.ts │ │ ├── Metrics.ts │ │ ├── MetricsEmbedData.ts │ │ ├── MetricsEmbedDataFieldsItem.ts │ │ ├── NonStreamedChatResponse.ts │ │ ├── OAuthAuthorizeResponse.ts │ │ ├── ParseInfo.ts │ │ ├── ReasoningEffort.ts │ │ ├── RerankDocument.ts │ │ ├── RerankRequestDocumentsItem.ts │ │ ├── RerankResponse.ts │ │ ├── RerankResponseResultsItem.ts │ │ ├── RerankResponseResultsItemDocument.ts │ │ ├── RerankerDataMetrics.ts │ │ ├── ResponseFormat.ts │ │ ├── ResponseFormatV2.ts │ │ ├── SingleGeneration.ts │ │ ├── SingleGenerationInStream.ts │ │ ├── SingleGenerationTokenLikelihoodsItem.ts │ │ ├── Source.ts │ │ ├── StreamedChatResponse.ts │ │ ├── StreamedChatResponseV2.ts │ │ ├── SummarizeRequestExtractiveness.ts │ │ ├── SummarizeRequestFormat.ts │ │ ├── SummarizeRequestLength.ts │ │ ├── SummarizeResponse.ts │ │ ├── SystemMessage.ts │ │ ├── SystemMessageContent.ts │ │ ├── SystemMessageContentItem.ts │ │ ├── TextContent.ts │ │ ├── TextResponseFormat.ts │ │ ├── TextResponseFormatV2.ts │ │ ├── TokenizeResponse.ts │ │ ├── Tool.ts │ │ ├── ToolCall.ts │ │ ├── ToolCallDelta.ts │ │ ├── ToolCallV2.ts │ │ ├── ToolCallV2Function.ts │ │ ├── ToolContent.ts │ │ ├── ToolMessage.ts │ │ ├── ToolMessageV2.ts │ │ ├── ToolMessageV2Content.ts │ │ ├── ToolParameterDefinitionsValue.ts │ │ ├── ToolResult.ts │ │ ├── ToolSource.ts │ │ ├── ToolV2.ts │ │ ├── ToolV2Function.ts │ │ ├── TruncationStrategy.ts │ │ ├── TruncationStrategyAutoPreserveOrder.ts │ │ ├── TruncationStrategyNone.ts │ │ ├── UpdateConnectorResponse.ts │ │ ├── Usage.ts │ │ ├── UsageBilledUnits.ts │ │ ├── UsageTokens.ts │ │ ├── UserMessage.ts │ │ ├── UserMessageContent.ts │ │ └── index.ts ├── aws-utils.ts ├── core │ ├── auth │ │ ├── BasicAuth.ts │ │ ├── BearerToken.ts │ │ └── index.ts │ ├── fetcher │ │ ├── APIResponse.ts │ │ ├── Fetcher.ts │ │ ├── Supplier.ts │ │ ├── createRequestUrl.ts │ │ ├── getFetchFn.ts │ │ ├── getHeader.ts │ │ ├── getRequestBody.ts │ │ ├── getResponseBody.ts │ │ ├── index.ts │ │ ├── makeRequest.ts │ │ ├── requestWithRetries.ts │ │ ├── signals.ts │ │ └── stream-wrappers │ │ │ ├── Node18UniversalStreamWrapper.ts │ │ │ ├── NodePre18StreamWrapper.ts │ │ │ ├── UndiciStreamWrapper.ts │ │ │ └── chooseStreamWrapper.ts │ ├── form-data-utils │ │ ├── FormDataWrapper.ts │ │ └── index.ts │ ├── index.ts │ ├── runtime │ │ ├── index.ts │ │ └── runtime.ts │ ├── schemas │ │ ├── Schema.ts │ │ ├── builders │ │ │ ├── bigint │ │ │ │ ├── bigint.ts │ │ │ │ └── index.ts │ │ │ ├── date │ │ │ │ ├── date.ts │ │ │ │ └── index.ts │ │ │ ├── enum │ │ │ │ ├── enum.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── lazy │ │ │ │ ├── index.ts │ │ │ │ ├── lazy.ts │ │ │ │ └── lazyObject.ts │ │ │ ├── list │ │ │ │ ├── index.ts │ │ │ │ └── list.ts │ │ │ ├── literals │ │ │ │ ├── booleanLiteral.ts │ │ │ │ ├── index.ts │ │ │ │ └── stringLiteral.ts │ │ │ ├── object-like │ │ │ │ ├── getObjectLikeUtils.ts │ │ │ │ ├── index.ts │ │ │ │ └── types.ts │ │ │ ├── object │ │ │ │ ├── index.ts │ │ │ │ ├── object.ts │ │ │ │ ├── objectWithoutOptionalProperties.ts │ │ │ │ ├── property.ts │ │ │ │ └── types.ts │ │ │ ├── primitives │ │ │ │ ├── any.ts │ │ │ │ ├── boolean.ts │ │ │ │ ├── index.ts │ │ │ │ ├── number.ts │ │ │ │ ├── string.ts │ │ │ │ └── unknown.ts │ │ │ ├── record │ │ │ │ ├── index.ts │ │ │ │ ├── record.ts │ │ │ │ └── types.ts │ │ │ ├── schema-utils │ │ │ │ ├── JsonError.ts │ │ │ │ ├── ParseError.ts │ │ │ │ ├── getSchemaUtils.ts │ │ │ │ ├── index.ts │ │ │ │ └── stringifyValidationErrors.ts │ │ │ ├── set │ │ │ │ ├── index.ts │ │ │ │ └── set.ts │ │ │ ├── undiscriminated-union │ │ │ │ ├── index.ts │ │ │ │ ├── types.ts │ │ │ │ └── undiscriminatedUnion.ts │ │ │ └── union │ │ │ │ ├── discriminant.ts │ │ │ │ ├── index.ts │ │ │ │ ├── types.ts │ │ │ │ └── union.ts │ │ ├── index.ts │ │ └── utils │ │ │ ├── MaybePromise.ts │ │ │ ├── addQuestionMarksToNullableProperties.ts │ │ │ ├── createIdentitySchemaCreator.ts │ │ │ ├── entries.ts │ │ │ ├── filterObject.ts │ │ │ ├── getErrorMessageForIncorrectType.ts │ │ │ ├── isPlainObject.ts │ │ │ ├── keys.ts │ │ │ ├── maybeSkipValidation.ts │ │ │ └── partition.ts │ └── streaming-fetcher │ │ ├── Stream.ts │ │ ├── index.ts │ │ └── streaming-utils.ts ├── environments.ts ├── errors │ ├── CohereError.ts │ ├── CohereTimeoutError.ts │ └── index.ts ├── index.ts ├── serialization │ ├── client │ │ ├── index.ts │ │ └── requests │ │ │ ├── ChatRequest.ts │ │ │ ├── ChatStreamRequest.ts │ │ │ ├── ClassifyRequest.ts │ │ │ ├── DetokenizeRequest.ts │ │ │ ├── EmbedRequest.ts │ │ │ ├── GenerateRequest.ts │ │ │ ├── GenerateStreamRequest.ts │ │ │ ├── RerankRequest.ts │ │ │ ├── SummarizeRequest.ts │ │ │ ├── TokenizeRequest.ts │ │ │ └── index.ts │ ├── index.ts │ ├── resources │ │ ├── connectors │ │ │ ├── client │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── CreateConnectorRequest.ts │ │ │ │ │ ├── UpdateConnectorRequest.ts │ │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ ├── datasets │ │ │ ├── client │ │ │ │ ├── delete.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── types │ │ │ │ ├── DatasetsCreateResponse.ts │ │ │ │ ├── DatasetsCreateResponseDatasetPartsItem.ts │ │ │ │ ├── DatasetsGetResponse.ts │ │ │ │ ├── DatasetsGetUsageResponse.ts │ │ │ │ ├── DatasetsListResponse.ts │ │ │ │ └── index.ts │ │ ├── embedJobs │ │ │ ├── client │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── CreateEmbedJobRequest.ts │ │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── types │ │ │ │ ├── CreateEmbedJobRequestTruncate.ts │ │ │ │ └── index.ts │ │ ├── finetuning │ │ │ ├── client │ │ │ │ ├── index.ts │ │ │ │ └── requests │ │ │ │ │ ├── FinetuningUpdateFinetunedModelRequest.ts │ │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── resources │ │ │ │ ├── finetuning │ │ │ │ ├── index.ts │ │ │ │ └── types │ │ │ │ │ ├── BaseModel.ts │ │ │ │ │ ├── BaseType.ts │ │ │ │ │ ├── CreateFinetunedModelResponse.ts │ │ │ │ │ ├── DeleteFinetunedModelResponse.ts │ │ │ │ │ ├── Event.ts │ │ │ │ │ ├── FinetunedModel.ts │ │ │ │ │ ├── GetFinetunedModelResponse.ts │ │ │ │ │ ├── Hyperparameters.ts │ │ │ │ │ ├── ListEventsResponse.ts │ │ │ │ │ ├── ListFinetunedModelsResponse.ts │ │ │ │ │ ├── ListTrainingStepMetricsResponse.ts │ │ │ │ │ ├── LoraTargetModules.ts │ │ │ │ │ ├── Settings.ts │ │ │ │ │ ├── Status.ts │ │ │ │ │ ├── Strategy.ts │ │ │ │ │ ├── TrainingStepMetrics.ts │ │ │ │ │ ├── UpdateFinetunedModelResponse.ts │ │ │ │ │ ├── WandbConfig.ts │ │ │ │ │ └── index.ts │ │ │ │ └── index.ts │ │ ├── index.ts │ │ └── v2 │ │ │ ├── client │ │ │ ├── index.ts │ │ │ └── requests │ │ │ │ ├── V2ChatRequest.ts │ │ │ │ ├── V2ChatStreamRequest.ts │ │ │ │ ├── V2EmbedRequest.ts │ │ │ │ ├── V2RerankRequest.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── types │ │ │ ├── V2ChatRequestDocumentsItem.ts │ │ │ ├── V2ChatRequestSafetyMode.ts │ │ │ ├── V2ChatRequestToolChoice.ts │ │ │ ├── V2ChatStreamRequestDocumentsItem.ts │ │ │ ├── V2ChatStreamRequestSafetyMode.ts │ │ │ ├── V2ChatStreamRequestToolChoice.ts │ │ │ ├── V2EmbedRequestTruncate.ts │ │ │ ├── V2RerankResponse.ts │ │ │ ├── V2RerankResponseResultsItem.ts │ │ │ ├── V2RerankResponseResultsItemDocument.ts │ │ │ └── index.ts │ └── types │ │ ├── ApiMeta.ts │ │ ├── ApiMetaApiVersion.ts │ │ ├── ApiMetaBilledUnits.ts │ │ ├── ApiMetaTokens.ts │ │ ├── AssistantMessage.ts │ │ ├── AssistantMessageContent.ts │ │ ├── AssistantMessageContentItem.ts │ │ ├── AssistantMessageResponse.ts │ │ ├── AssistantMessageResponseContentItem.ts │ │ ├── AuthTokenType.ts │ │ ├── ChatCitation.ts │ │ ├── ChatCitationGenerationEvent.ts │ │ ├── ChatCitationType.ts │ │ ├── ChatConnector.ts │ │ ├── ChatContentDeltaEvent.ts │ │ ├── ChatContentDeltaEventDelta.ts │ │ ├── ChatContentDeltaEventDeltaMessage.ts │ │ ├── ChatContentDeltaEventDeltaMessageContent.ts │ │ ├── ChatContentEndEvent.ts │ │ ├── ChatContentStartEvent.ts │ │ ├── ChatContentStartEventDelta.ts │ │ ├── ChatContentStartEventDeltaMessage.ts │ │ ├── ChatContentStartEventDeltaMessageContent.ts │ │ ├── ChatDataMetrics.ts │ │ ├── ChatDebugEvent.ts │ │ ├── ChatDocument.ts │ │ ├── ChatFinishReason.ts │ │ ├── ChatMessage.ts │ │ ├── ChatMessageEndEvent.ts │ │ ├── ChatMessageEndEventDelta.ts │ │ ├── ChatMessageStartEvent.ts │ │ ├── ChatMessageStartEventDelta.ts │ │ ├── ChatMessageStartEventDeltaMessage.ts │ │ ├── ChatMessageV2.ts │ │ ├── ChatMessages.ts │ │ ├── ChatRequestCitationQuality.ts │ │ ├── ChatRequestConnectorsSearchOptions.ts │ │ ├── ChatRequestPromptTruncation.ts │ │ ├── ChatRequestSafetyMode.ts │ │ ├── ChatResponse.ts │ │ ├── ChatSearchQueriesGenerationEvent.ts │ │ ├── ChatSearchQuery.ts │ │ ├── ChatSearchResult.ts │ │ ├── ChatSearchResultConnector.ts │ │ ├── ChatSearchResultsEvent.ts │ │ ├── ChatStreamEndEvent.ts │ │ ├── ChatStreamEndEventFinishReason.ts │ │ ├── ChatStreamEvent.ts │ │ ├── ChatStreamEventType.ts │ │ ├── ChatStreamRequestCitationQuality.ts │ │ ├── ChatStreamRequestConnectorsSearchOptions.ts │ │ ├── ChatStreamRequestPromptTruncation.ts │ │ ├── ChatStreamRequestSafetyMode.ts │ │ ├── ChatStreamStartEvent.ts │ │ ├── ChatTextGenerationEvent.ts │ │ ├── ChatToolCallDeltaEvent.ts │ │ ├── ChatToolCallDeltaEventDelta.ts │ │ ├── ChatToolCallDeltaEventDeltaMessage.ts │ │ ├── ChatToolCallDeltaEventDeltaMessageToolCalls.ts │ │ ├── ChatToolCallDeltaEventDeltaMessageToolCallsFunction.ts │ │ ├── ChatToolCallEndEvent.ts │ │ ├── ChatToolCallStartEvent.ts │ │ ├── ChatToolCallStartEventDelta.ts │ │ ├── ChatToolCallStartEventDeltaMessage.ts │ │ ├── ChatToolCallsChunkEvent.ts │ │ ├── ChatToolCallsGenerationEvent.ts │ │ ├── ChatToolPlanDeltaEvent.ts │ │ ├── ChatToolPlanDeltaEventDelta.ts │ │ ├── ChatToolPlanDeltaEventDeltaMessage.ts │ │ ├── CheckApiKeyResponse.ts │ │ ├── Citation.ts │ │ ├── CitationEndEvent.ts │ │ ├── CitationOptions.ts │ │ ├── CitationOptionsMode.ts │ │ ├── CitationStartEvent.ts │ │ ├── CitationStartEventDelta.ts │ │ ├── CitationStartEventDeltaMessage.ts │ │ ├── CitationType.ts │ │ ├── ClassifyDataMetrics.ts │ │ ├── ClassifyExample.ts │ │ ├── ClassifyRequestTruncate.ts │ │ ├── ClassifyResponse.ts │ │ ├── ClassifyResponseClassificationsItem.ts │ │ ├── ClassifyResponseClassificationsItemClassificationType.ts │ │ ├── ClassifyResponseClassificationsItemLabelsValue.ts │ │ ├── CompatibleEndpoint.ts │ │ ├── Connector.ts │ │ ├── ConnectorAuthStatus.ts │ │ ├── ConnectorOAuth.ts │ │ ├── Content.ts │ │ ├── CreateConnectorOAuth.ts │ │ ├── CreateConnectorResponse.ts │ │ ├── CreateConnectorServiceAuth.ts │ │ ├── CreateEmbedJobResponse.ts │ │ ├── Dataset.ts │ │ ├── DatasetPart.ts │ │ ├── DatasetType.ts │ │ ├── DatasetValidationStatus.ts │ │ ├── DeleteConnectorResponse.ts │ │ ├── DetokenizeResponse.ts │ │ ├── Document.ts │ │ ├── DocumentContent.ts │ │ ├── DocumentSource.ts │ │ ├── EmbedByTypeResponse.ts │ │ ├── EmbedByTypeResponseEmbeddings.ts │ │ ├── EmbedContent.ts │ │ ├── EmbedFloatsResponse.ts │ │ ├── EmbedImage.ts │ │ ├── EmbedImageUrl.ts │ │ ├── EmbedInput.ts │ │ ├── EmbedInputType.ts │ │ ├── EmbedJob.ts │ │ ├── EmbedJobStatus.ts │ │ ├── EmbedJobTruncate.ts │ │ ├── EmbedRequestTruncate.ts │ │ ├── EmbedResponse.ts │ │ ├── EmbedText.ts │ │ ├── EmbeddingType.ts │ │ ├── FinetuneDatasetMetrics.ts │ │ ├── FinishReason.ts │ │ ├── GenerateRequestReturnLikelihoods.ts │ │ ├── GenerateRequestTruncate.ts │ │ ├── GenerateStreamEnd.ts │ │ ├── GenerateStreamEndResponse.ts │ │ ├── GenerateStreamError.ts │ │ ├── GenerateStreamEvent.ts │ │ ├── GenerateStreamRequestReturnLikelihoods.ts │ │ ├── GenerateStreamRequestTruncate.ts │ │ ├── GenerateStreamText.ts │ │ ├── GenerateStreamedResponse.ts │ │ ├── Generation.ts │ │ ├── GetConnectorResponse.ts │ │ ├── GetModelResponse.ts │ │ ├── Image.ts │ │ ├── ImageContent.ts │ │ ├── ImageUrl.ts │ │ ├── JsonResponseFormat.ts │ │ ├── JsonResponseFormatV2.ts │ │ ├── LabelMetric.ts │ │ ├── ListConnectorsResponse.ts │ │ ├── ListEmbedJobResponse.ts │ │ ├── ListModelsResponse.ts │ │ ├── LogprobItem.ts │ │ ├── Message.ts │ │ ├── Metrics.ts │ │ ├── MetricsEmbedData.ts │ │ ├── MetricsEmbedDataFieldsItem.ts │ │ ├── NonStreamedChatResponse.ts │ │ ├── OAuthAuthorizeResponse.ts │ │ ├── ParseInfo.ts │ │ ├── ReasoningEffort.ts │ │ ├── RerankDocument.ts │ │ ├── RerankRequestDocumentsItem.ts │ │ ├── RerankResponse.ts │ │ ├── RerankResponseResultsItem.ts │ │ ├── RerankResponseResultsItemDocument.ts │ │ ├── RerankerDataMetrics.ts │ │ ├── ResponseFormat.ts │ │ ├── ResponseFormatV2.ts │ │ ├── SingleGeneration.ts │ │ ├── SingleGenerationInStream.ts │ │ ├── SingleGenerationTokenLikelihoodsItem.ts │ │ ├── Source.ts │ │ ├── StreamedChatResponse.ts │ │ ├── StreamedChatResponseV2.ts │ │ ├── SummarizeRequestExtractiveness.ts │ │ ├── SummarizeRequestFormat.ts │ │ ├── SummarizeRequestLength.ts │ │ ├── SummarizeResponse.ts │ │ ├── SystemMessage.ts │ │ ├── SystemMessageContent.ts │ │ ├── SystemMessageContentItem.ts │ │ ├── TextContent.ts │ │ ├── TextResponseFormat.ts │ │ ├── TextResponseFormatV2.ts │ │ ├── TokenizeResponse.ts │ │ ├── Tool.ts │ │ ├── ToolCall.ts │ │ ├── ToolCallDelta.ts │ │ ├── ToolCallV2.ts │ │ ├── ToolCallV2Function.ts │ │ ├── ToolContent.ts │ │ ├── ToolMessage.ts │ │ ├── ToolMessageV2.ts │ │ ├── ToolMessageV2Content.ts │ │ ├── ToolParameterDefinitionsValue.ts │ │ ├── ToolResult.ts │ │ ├── ToolSource.ts │ │ ├── ToolV2.ts │ │ ├── ToolV2Function.ts │ │ ├── TruncationStrategy.ts │ │ ├── TruncationStrategyAutoPreserveOrder.ts │ │ ├── TruncationStrategyNone.ts │ │ ├── UpdateConnectorResponse.ts │ │ ├── Usage.ts │ │ ├── UsageBilledUnits.ts │ │ ├── UsageTokens.ts │ │ ├── UserMessage.ts │ │ ├── UserMessageContent.ts │ │ └── index.ts ├── test │ ├── __snapshots__ │ │ ├── aws-util-tests.test.ts.snap │ │ └── client.test.ts.snap │ ├── aws-util-tests.test.ts │ ├── bedrock-tests.test.ts │ ├── client.test.ts │ ├── env.test.ts │ ├── tests.test.ts │ └── testsV2.test.ts └── version.ts ├── tests ├── custom.test.ts └── unit │ ├── auth │ ├── BasicAuth.test.ts │ └── BearerToken.test.ts │ ├── fetcher │ ├── Fetcher.test.ts │ ├── createRequestUrl.test.ts │ ├── getFetchFn.test.ts │ ├── getRequestBody.test.ts │ ├── getResponseBody.test.ts │ ├── makeRequest.test.ts │ ├── requestWithRetries.test.ts │ ├── signals.test.ts │ ├── stream-wrappers │ │ ├── Node18UniversalStreamWrapper.test.ts │ │ ├── NodePre18StreamWrapper.test.ts │ │ ├── UndiciStreamWrapper.test.ts │ │ ├── chooseStreamWrapper.test.ts │ │ └── webpack.test.ts │ └── test-file.txt │ ├── form-data-utils │ └── formDataWrapper.test.ts │ └── zurg │ ├── bigint │ └── bigint.test.ts │ ├── date │ └── date.test.ts │ ├── enum │ └── enum.test.ts │ ├── lazy │ ├── lazy.test.ts │ ├── lazyObject.test.ts │ └── recursive │ │ ├── a.ts │ │ └── b.ts │ ├── list │ └── list.test.ts │ ├── literals │ └── stringLiteral.test.ts │ ├── object-like │ └── withParsedProperties.test.ts │ ├── object │ ├── extend.test.ts │ ├── object.test.ts │ ├── objectWithoutOptionalProperties.test.ts │ └── passthrough.test.ts │ ├── primitives │ ├── any.test.ts │ ├── boolean.test.ts │ ├── number.test.ts │ ├── string.test.ts │ └── unknown.test.ts │ ├── record │ └── record.test.ts │ ├── schema-utils │ └── getSchemaUtils.test.ts │ ├── schema.test.ts │ ├── set │ └── set.test.ts │ ├── skipValidation.test.ts │ ├── undiscriminated-union │ └── undiscriminatedUnion.test.ts │ ├── union │ └── union.test.ts │ └── utils │ ├── itSchema.ts │ └── itValidate.ts ├── tsconfig.json └── yarn.lock /.fernignore: -------------------------------------------------------------------------------- 1 | # Specify files that shouldn't be modified by Fern 2 | README.md 3 | banner.png 4 | .npmignore 5 | src/test 6 | jest.config.js 7 | .github/workflows/test.yml 8 | .github/workflows/ci.yml 9 | LICENSE 10 | src/BedrockClient.ts 11 | src/AwsClient.ts 12 | src/SagemakerClient.ts 13 | src/index.ts 14 | src/aws-utils.ts 15 | src/core/streaming-fetcher/streaming-utils.ts 16 | src/ClientV2.ts 17 | src/CustomClient.ts 18 | src/core/form-data-utils/FormDataWrapper.ts 19 | tests/unit/form-data-utils/formDataWrapper.test.ts 20 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | on: 3 | pull_request: {} 4 | workflow_dispatch: {} 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - name: Install modules 11 | run: yarn 12 | - name: Run tests 13 | env: 14 | COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} 15 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 16 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 17 | AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} 18 | run: yarn run jest 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | /dist -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | src 3 | .gitignore 4 | .github 5 | .fernignore 6 | .prettierrc.yml 7 | tsconfig.json 8 | yarn.lock 9 | banner.png -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | tabWidth: 4 2 | printWidth: 120 3 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cohere-ai/cohere-typescript/5cad98dbf27e61d3c2bb54a804ebca843763833a/banner.png -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | transform: { 4 | '^.+\\.(ts|tsx)?$': 'ts-jest', 5 | }, 6 | testTimeout: 300000, 7 | }; 8 | -------------------------------------------------------------------------------- /src/AwsClient.ts: -------------------------------------------------------------------------------- 1 | import { AwsProps } from './aws-utils'; 2 | import { CohereClient } from "./Client"; 3 | import { CohereClientV2 } from './ClientV2'; 4 | 5 | export class AwsClient extends CohereClient { 6 | constructor(_options: CohereClient.Options & AwsProps) { 7 | _options.token = "n/a"; // AWS clients don't need a token but setting to this to a string so Fern doesn't complain 8 | super(_options); 9 | } 10 | } 11 | 12 | export class AwsClientV2 extends CohereClientV2 { 13 | constructor(_options: CohereClient.Options & AwsProps) { 14 | _options.token = "n/a"; // AWS clients don't need a token but setting to this to a string so Fern doesn't complain 15 | super(_options); 16 | } 17 | } -------------------------------------------------------------------------------- /src/BedrockClient.ts: -------------------------------------------------------------------------------- 1 | import { AwsProps, fetchOverride } from './aws-utils'; 2 | import { AwsClient, AwsClientV2 } from './AwsClient'; 3 | import { CohereClient } from "./Client"; 4 | 5 | export class BedrockClient extends AwsClient { 6 | constructor(_options: CohereClient.Options & AwsProps) { 7 | super({ ..._options, fetcher: fetchOverride("bedrock", _options) }); 8 | } 9 | } 10 | 11 | export class BedrockClientV2 extends AwsClientV2 { 12 | constructor(_options: CohereClient.Options & AwsProps) { 13 | super({ ..._options, fetcher: fetchOverride("bedrock", _options) }); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/CustomClient.ts: -------------------------------------------------------------------------------- 1 | import { CohereClient } from "./Client"; 2 | 3 | export class CustomClient extends CohereClient { 4 | constructor(protected readonly _options: CohereClient.Options = {}) { 5 | try { 6 | // if url ends with /v1, drop it for back compat 7 | const match = /\/v1\/?$/ 8 | const fixed = _options.environment?.toString().replace(match, ""); 9 | if (fixed !== _options.environment?.toString()) { 10 | _options.environment = fixed 11 | } 12 | } catch { } 13 | 14 | super(_options) 15 | } 16 | } -------------------------------------------------------------------------------- /src/SagemakerClient.ts: -------------------------------------------------------------------------------- 1 | import { AwsClient, AwsClientV2 } from './AwsClient'; 2 | import { CohereClient } from "./Client"; 3 | import { AwsProps, fetchOverride } from './aws-utils'; 4 | 5 | 6 | export class SagemakerClient extends AwsClient { 7 | constructor(_options: CohereClient.Options & AwsProps) { 8 | super({ ..._options, fetcher: fetchOverride("sagemaker", _options) }); 9 | } 10 | } 11 | 12 | export class SagemakerClientV2 extends AwsClientV2 { 13 | constructor(_options: CohereClient.Options & AwsProps) { 14 | super({ ..._options, fetcher: fetchOverride("sagemaker", _options) }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/client/requests/DetokenizeRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * { 8 | * tokens: [1], 9 | * model: "model" 10 | * } 11 | */ 12 | export interface DetokenizeRequest { 13 | /** The list of tokens to be detokenized. */ 14 | tokens: number[]; 15 | /** An optional parameter to provide the model name. This will ensure that the detokenization is done by the tokenizer used by that model. */ 16 | model: string; 17 | } 18 | -------------------------------------------------------------------------------- /src/api/client/requests/TokenizeRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * { 8 | * text: "tokenize me! :D", 9 | * model: "command" 10 | * } 11 | */ 12 | export interface TokenizeRequest { 13 | /** The string to be tokenized, the minimum text length is 1 character, and the maximum text length is 65536 characters. */ 14 | text: string; 15 | /** An optional parameter to provide the model name. This will ensure that the tokenization uses the tokenizer used by that model. */ 16 | model: string; 17 | } 18 | -------------------------------------------------------------------------------- /src/api/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { type ChatStreamRequest } from "./ChatStreamRequest"; 2 | export { type ChatRequest } from "./ChatRequest"; 3 | export { type GenerateStreamRequest } from "./GenerateStreamRequest"; 4 | export { type GenerateRequest } from "./GenerateRequest"; 5 | export { type EmbedRequest } from "./EmbedRequest"; 6 | export { type RerankRequest } from "./RerankRequest"; 7 | export { type ClassifyRequest } from "./ClassifyRequest"; 8 | export { type SummarizeRequest } from "./SummarizeRequest"; 9 | export { type TokenizeRequest } from "./TokenizeRequest"; 10 | export { type DetokenizeRequest } from "./DetokenizeRequest"; 11 | -------------------------------------------------------------------------------- /src/api/errors/BadRequestError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class BadRequestError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "BadRequestError", 11 | statusCode: 400, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, BadRequestError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/ClientClosedRequestError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class ClientClosedRequestError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "ClientClosedRequestError", 11 | statusCode: 499, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, ClientClosedRequestError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/ForbiddenError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class ForbiddenError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "ForbiddenError", 11 | statusCode: 403, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, ForbiddenError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/GatewayTimeoutError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class GatewayTimeoutError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "GatewayTimeoutError", 11 | statusCode: 504, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, GatewayTimeoutError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/InternalServerError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class InternalServerError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "InternalServerError", 11 | statusCode: 500, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, InternalServerError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/InvalidTokenError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class InvalidTokenError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "InvalidTokenError", 11 | statusCode: 498, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, InvalidTokenError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/NotFoundError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class NotFoundError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "NotFoundError", 11 | statusCode: 404, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, NotFoundError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/NotImplementedError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class NotImplementedError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "NotImplementedError", 11 | statusCode: 501, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, NotImplementedError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/ServiceUnavailableError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class ServiceUnavailableError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "ServiceUnavailableError", 11 | statusCode: 503, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, ServiceUnavailableError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/TooManyRequestsError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class TooManyRequestsError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "TooManyRequestsError", 11 | statusCode: 429, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, TooManyRequestsError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/UnauthorizedError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class UnauthorizedError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "UnauthorizedError", 11 | statusCode: 401, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, UnauthorizedError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/UnprocessableEntityError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as errors from "../../errors/index"; 6 | 7 | export class UnprocessableEntityError extends errors.CohereError { 8 | constructor(body?: unknown) { 9 | super({ 10 | message: "UnprocessableEntityError", 11 | statusCode: 422, 12 | body: body, 13 | }); 14 | Object.setPrototypeOf(this, UnprocessableEntityError.prototype); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/api/errors/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./BadRequestError"; 2 | export * from "./UnauthorizedError"; 3 | export * from "./ForbiddenError"; 4 | export * from "./NotFoundError"; 5 | export * from "./UnprocessableEntityError"; 6 | export * from "./TooManyRequestsError"; 7 | export * from "./InvalidTokenError"; 8 | export * from "./ClientClosedRequestError"; 9 | export * from "./InternalServerError"; 10 | export * from "./NotImplementedError"; 11 | export * from "./ServiceUnavailableError"; 12 | export * from "./GatewayTimeoutError"; 13 | -------------------------------------------------------------------------------- /src/api/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./resources"; 2 | export * from "./types"; 3 | export * from "./errors"; 4 | export * from "./client"; 5 | -------------------------------------------------------------------------------- /src/api/resources/connectors/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/connectors/client/requests/ConnectorsListRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * {} 8 | */ 9 | export interface ConnectorsListRequest { 10 | /** 11 | * Maximum number of connectors to return [0, 100]. 12 | */ 13 | limit?: number; 14 | /** 15 | * Number of connectors to skip before returning results [0, inf]. 16 | */ 17 | offset?: number; 18 | } 19 | -------------------------------------------------------------------------------- /src/api/resources/connectors/client/requests/ConnectorsOAuthAuthorizeRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * {} 8 | */ 9 | export interface ConnectorsOAuthAuthorizeRequest { 10 | /** 11 | * The URL to redirect to after the connector has been authorized. 12 | */ 13 | afterTokenRedirect?: string; 14 | } 15 | -------------------------------------------------------------------------------- /src/api/resources/connectors/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { type ConnectorsListRequest } from "./ConnectorsListRequest"; 2 | export { type CreateConnectorRequest } from "./CreateConnectorRequest"; 3 | export { type UpdateConnectorRequest } from "./UpdateConnectorRequest"; 4 | export { type ConnectorsOAuthAuthorizeRequest } from "./ConnectorsOAuthAuthorizeRequest"; 5 | -------------------------------------------------------------------------------- /src/api/resources/connectors/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/datasets/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/datasets/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { type DatasetsListRequest } from "./DatasetsListRequest"; 2 | export { type DatasetsCreateRequest } from "./DatasetsCreateRequest"; 3 | -------------------------------------------------------------------------------- /src/api/resources/datasets/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | export * from "./client"; 3 | -------------------------------------------------------------------------------- /src/api/resources/datasets/types/DatasetsCreateResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface DatasetsCreateResponse { 6 | /** The dataset ID */ 7 | id?: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/resources/datasets/types/DatasetsCreateResponseDatasetPartsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * the underlying files that make up the dataset 7 | */ 8 | export interface DatasetsCreateResponseDatasetPartsItem { 9 | /** the name of the dataset part */ 10 | name?: string; 11 | /** the number of rows in the dataset part */ 12 | numRows?: number; 13 | samples?: string[]; 14 | /** the kind of dataset part */ 15 | partKind?: string; 16 | } 17 | -------------------------------------------------------------------------------- /src/api/resources/datasets/types/DatasetsGetResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../index"; 6 | 7 | export interface DatasetsGetResponse { 8 | dataset: Cohere.Dataset; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/resources/datasets/types/DatasetsGetUsageResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface DatasetsGetUsageResponse { 6 | /** The total number of bytes used by the organization. */ 7 | organizationUsage?: number; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/resources/datasets/types/DatasetsListResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../index"; 6 | 7 | export interface DatasetsListResponse { 8 | datasets?: Cohere.Dataset[]; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/resources/datasets/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./DatasetsListResponse"; 2 | export * from "./DatasetsCreateResponseDatasetPartsItem"; 3 | export * from "./DatasetsCreateResponse"; 4 | export * from "./DatasetsGetUsageResponse"; 5 | export * from "./DatasetsGetResponse"; 6 | -------------------------------------------------------------------------------- /src/api/resources/embedJobs/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/embedJobs/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { type CreateEmbedJobRequest } from "./CreateEmbedJobRequest"; 2 | -------------------------------------------------------------------------------- /src/api/resources/embedJobs/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | export * from "./client"; 3 | -------------------------------------------------------------------------------- /src/api/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * One of `START|END` to specify how the API will handle inputs longer than the maximum token length. 7 | * 8 | * Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. 9 | */ 10 | export type CreateEmbedJobRequestTruncate = "START" | "END"; 11 | export const CreateEmbedJobRequestTruncate = { 12 | Start: "START", 13 | End: "END", 14 | } as const; 15 | -------------------------------------------------------------------------------- /src/api/resources/embedJobs/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./CreateEmbedJobRequestTruncate"; 2 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/client/requests/FinetuningListTrainingStepMetricsRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * @example 7 | * {} 8 | */ 9 | export interface FinetuningListTrainingStepMetricsRequest { 10 | /** 11 | * Maximum number of results to be returned by the server. If 0, defaults to 12 | * 50. 13 | */ 14 | pageSize?: number; 15 | /** 16 | * Request a specific page of the list results. 17 | */ 18 | pageToken?: string; 19 | } 20 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { type FinetuningListFinetunedModelsRequest } from "./FinetuningListFinetunedModelsRequest"; 2 | export { type FinetuningUpdateFinetunedModelRequest } from "./FinetuningUpdateFinetunedModelRequest"; 3 | export { type FinetuningListEventsRequest } from "./FinetuningListEventsRequest"; 4 | export { type FinetuningListTrainingStepMetricsRequest } from "./FinetuningListTrainingStepMetricsRequest"; 5 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./resources"; 2 | export * from "./client"; 3 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/BaseModel.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../../../index"; 6 | 7 | /** 8 | * The base model used for fine-tuning. 9 | */ 10 | export interface BaseModel { 11 | /** The name of the base model. */ 12 | name?: string; 13 | /** read-only. The version of the base model. */ 14 | version?: string; 15 | /** The type of the base model. */ 16 | baseType: Cohere.finetuning.BaseType; 17 | /** Deprecated: The fine-tuning strategy. */ 18 | strategy?: Cohere.finetuning.Strategy; 19 | } 20 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/CreateFinetunedModelResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../../../index"; 6 | 7 | /** 8 | * Response to request to create a fine-tuned model. 9 | */ 10 | export interface CreateFinetunedModelResponse { 11 | /** Information about the fine-tuned model. */ 12 | finetunedModel?: Cohere.finetuning.FinetunedModel; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/DeleteFinetunedModelResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Response to request to delete a fine-tuned model. 7 | */ 8 | export type DeleteFinetunedModelResponse = Record; 9 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/Event.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../../../index"; 6 | 7 | /** 8 | * A change in status of a fine-tuned model. 9 | */ 10 | export interface Event { 11 | /** ID of the user who initiated the event. Empty if initiated by the system. */ 12 | userId?: string; 13 | /** Status of the fine-tuned model. */ 14 | status?: Cohere.finetuning.Status; 15 | /** Timestamp when the event happened. */ 16 | createdAt?: Date; 17 | } 18 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/GetFinetunedModelResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../../../index"; 6 | 7 | /** 8 | * Response to a request to get a fine-tuned model. 9 | */ 10 | export interface GetFinetunedModelResponse { 11 | /** Information about the fine-tuned model. */ 12 | finetunedModel?: Cohere.finetuning.FinetunedModel; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/ListEventsResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../../../index"; 6 | 7 | /** 8 | * Response to a request to list events of a fine-tuned model. 9 | */ 10 | export interface ListEventsResponse { 11 | /** List of events for the fine-tuned model. */ 12 | events?: Cohere.finetuning.Event[]; 13 | /** 14 | * Pagination token to retrieve the next page of results. If the value is "", 15 | * it means no further results for the request. 16 | */ 17 | nextPageToken?: string; 18 | /** Total count of results. */ 19 | totalSize?: number; 20 | } 21 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/ListTrainingStepMetricsResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../../../index"; 6 | 7 | /** 8 | * Response to a request to list training-step metrics of a fine-tuned model. 9 | */ 10 | export interface ListTrainingStepMetricsResponse { 11 | /** The metrics for each step the evaluation was run on. */ 12 | stepMetrics?: Cohere.finetuning.TrainingStepMetrics[]; 13 | /** 14 | * Pagination token to retrieve the next page of results. If the value is "", 15 | * it means no further results for the request. 16 | */ 17 | nextPageToken?: string; 18 | } 19 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/Strategy.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The possible strategy used to serve a fine-tuned models. 7 | * 8 | * - STRATEGY_UNSPECIFIED: Unspecified strategy. 9 | * - STRATEGY_VANILLA: Deprecated: Serve the fine-tuned model on a dedicated GPU. 10 | * - STRATEGY_TFEW: Deprecated: Serve the fine-tuned model on a shared GPU. 11 | */ 12 | export type Strategy = "STRATEGY_UNSPECIFIED" | "STRATEGY_VANILLA" | "STRATEGY_TFEW"; 13 | export const Strategy = { 14 | StrategyUnspecified: "STRATEGY_UNSPECIFIED", 15 | StrategyVanilla: "STRATEGY_VANILLA", 16 | StrategyTfew: "STRATEGY_TFEW", 17 | } as const; 18 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/TrainingStepMetrics.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The evaluation metrics at a given step of the training of a fine-tuned model. 7 | */ 8 | export interface TrainingStepMetrics { 9 | /** Creation timestamp. */ 10 | createdAt?: Date; 11 | /** Step number. */ 12 | stepNumber?: number; 13 | /** Map of names and values for each evaluation metrics. */ 14 | metrics?: Record; 15 | } 16 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/UpdateFinetunedModelResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../../../index"; 6 | 7 | /** 8 | * Response to a request to update a fine-tuned model. 9 | */ 10 | export interface UpdateFinetunedModelResponse { 11 | /** Information about the fine-tuned model. */ 12 | finetunedModel?: Cohere.finetuning.FinetunedModel; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/finetuning/types/WandbConfig.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The Weights & Biases configuration. 7 | */ 8 | export interface WandbConfig { 9 | /** The WandB project name to be used during training. */ 10 | project: string; 11 | /** The WandB API key to be used during training. */ 12 | apiKey: string; 13 | /** The WandB entity name to be used during training. */ 14 | entity?: string; 15 | } 16 | -------------------------------------------------------------------------------- /src/api/resources/finetuning/resources/index.ts: -------------------------------------------------------------------------------- 1 | export * as finetuning from "./finetuning"; 2 | export * from "./finetuning/types"; 3 | -------------------------------------------------------------------------------- /src/api/resources/index.ts: -------------------------------------------------------------------------------- 1 | export * as v2 from "./v2"; 2 | export * from "./v2/types"; 3 | export * as embedJobs from "./embedJobs"; 4 | export * from "./embedJobs/types"; 5 | export * as datasets from "./datasets"; 6 | export * from "./datasets/types"; 7 | export * as finetuning from "./finetuning"; 8 | export * as connectors from "./connectors"; 9 | export * as models from "./models"; 10 | export * from "./v2/client/requests"; 11 | export * from "./embedJobs/client/requests"; 12 | export * from "./datasets/client/requests"; 13 | export * from "./connectors/client/requests"; 14 | export * from "./models/client/requests"; 15 | export * from "./finetuning/client/requests"; 16 | -------------------------------------------------------------------------------- /src/api/resources/models/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/models/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { type ModelsListRequest } from "./ModelsListRequest"; 2 | -------------------------------------------------------------------------------- /src/api/resources/models/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/api/resources/v2/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/api/resources/v2/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { type V2ChatStreamRequest } from "./V2ChatStreamRequest"; 2 | export { type V2ChatRequest } from "./V2ChatRequest"; 3 | export { type V2EmbedRequest } from "./V2EmbedRequest"; 4 | export { type V2RerankRequest } from "./V2RerankRequest"; 5 | -------------------------------------------------------------------------------- /src/api/resources/v2/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | export * from "./client"; 3 | -------------------------------------------------------------------------------- /src/api/resources/v2/types/V2ChatRequestDocumentsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../index"; 6 | 7 | export type V2ChatRequestDocumentsItem = string | Cohere.Document; 8 | -------------------------------------------------------------------------------- /src/api/resources/v2/types/V2ChatStreamRequestDocumentsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../index"; 6 | 7 | export type V2ChatStreamRequestDocumentsItem = string | Cohere.Document; 8 | -------------------------------------------------------------------------------- /src/api/resources/v2/types/V2RerankResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../../../index"; 6 | 7 | export interface V2RerankResponse { 8 | id?: string; 9 | /** An ordered list of ranked documents */ 10 | results: Cohere.V2RerankResponseResultsItem[]; 11 | meta?: Cohere.ApiMeta; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/resources/v2/types/V2RerankResponseResultsItemDocument.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * If `return_documents` is set as `false` this will return none, if `true` it will return the documents passed in 7 | */ 8 | export interface V2RerankResponseResultsItemDocument { 9 | /** The text of the document to rerank */ 10 | text: string; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/resources/v2/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./V2ChatStreamRequestDocumentsItem"; 2 | export * from "./V2ChatStreamRequestSafetyMode"; 3 | export * from "./V2ChatStreamRequestToolChoice"; 4 | export * from "./V2ChatRequestDocumentsItem"; 5 | export * from "./V2ChatRequestSafetyMode"; 6 | export * from "./V2ChatRequestToolChoice"; 7 | export * from "./V2EmbedRequestTruncate"; 8 | export * from "./V2RerankResponseResultsItemDocument"; 9 | export * from "./V2RerankResponseResultsItem"; 10 | export * from "./V2RerankResponse"; 11 | -------------------------------------------------------------------------------- /src/api/types/ApiMeta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ApiMeta { 8 | apiVersion?: Cohere.ApiMetaApiVersion; 9 | billedUnits?: Cohere.ApiMetaBilledUnits; 10 | tokens?: Cohere.ApiMetaTokens; 11 | warnings?: string[]; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ApiMetaApiVersion.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ApiMetaApiVersion { 6 | version: string; 7 | isDeprecated?: boolean; 8 | isExperimental?: boolean; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ApiMetaBilledUnits.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ApiMetaBilledUnits { 6 | /** The number of billed images. */ 7 | images?: number; 8 | /** The number of billed input tokens. */ 9 | inputTokens?: number; 10 | /** The number of billed output tokens. */ 11 | outputTokens?: number; 12 | /** The number of billed search units. */ 13 | searchUnits?: number; 14 | /** The number of billed classifications units. */ 15 | classifications?: number; 16 | } 17 | -------------------------------------------------------------------------------- /src/api/types/ApiMetaTokens.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ApiMetaTokens { 6 | /** The number of tokens used as input to the model. */ 7 | inputTokens?: number; 8 | /** The number of tokens produced by the model. */ 9 | outputTokens?: number; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/AssistantMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A message from the assistant role can contain text and tool call information. 9 | */ 10 | export interface AssistantMessage { 11 | toolCalls?: Cohere.ToolCallV2[]; 12 | /** A chain-of-thought style reflection and plan that the model generates when working with Tools. */ 13 | toolPlan?: string; 14 | content?: Cohere.AssistantMessageContent; 15 | citations?: Cohere.Citation[]; 16 | } 17 | -------------------------------------------------------------------------------- /src/api/types/AssistantMessageContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export type AssistantMessageContent = string | Cohere.AssistantMessageContentItem[]; 8 | -------------------------------------------------------------------------------- /src/api/types/AssistantMessageContentItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export type AssistantMessageContentItem = Cohere.AssistantMessageContentItem.Text; 8 | 9 | export namespace AssistantMessageContentItem { 10 | export interface Text extends Cohere.TextContent { 11 | type: "text"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/AssistantMessageResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A message from the assistant role can contain text and tool call information. 9 | */ 10 | export interface AssistantMessageResponse { 11 | role: "assistant"; 12 | toolCalls?: Cohere.ToolCallV2[]; 13 | /** A chain-of-thought style reflection and plan that the model generates when working with Tools. */ 14 | toolPlan?: string; 15 | content?: Cohere.AssistantMessageResponseContentItem[]; 16 | citations?: Cohere.Citation[]; 17 | } 18 | -------------------------------------------------------------------------------- /src/api/types/AssistantMessageResponseContentItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export type AssistantMessageResponseContentItem = Cohere.AssistantMessageResponseContentItem.Text; 8 | 9 | export namespace AssistantMessageResponseContentItem { 10 | export interface Text extends Cohere.TextContent { 11 | type: "text"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/AuthTokenType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The token_type specifies the way the token is passed in the Authorization header. Valid values are "bearer", "basic", and "noscheme". 7 | */ 8 | export type AuthTokenType = "bearer" | "basic" | "noscheme"; 9 | export const AuthTokenType = { 10 | Bearer: "bearer", 11 | Basic: "basic", 12 | Noscheme: "noscheme", 13 | } as const; 14 | -------------------------------------------------------------------------------- /src/api/types/ChatCitationGenerationEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatCitationGenerationEvent extends Cohere.ChatStreamEvent { 8 | /** Citations for the generated reply. */ 9 | citations: Cohere.ChatCitation[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/ChatCitationType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The type of citation which indicates what part of the response the citation is for. 7 | */ 8 | export type ChatCitationType = "TEXT_CONTENT" | "PLAN"; 9 | export const ChatCitationType = { 10 | TextContent: "TEXT_CONTENT", 11 | Plan: "PLAN", 12 | } as const; 13 | -------------------------------------------------------------------------------- /src/api/types/ChatContentDeltaEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed delta event which contains a delta of chat text content. 9 | */ 10 | export interface ChatContentDeltaEvent extends Cohere.ChatStreamEventType { 11 | index?: number; 12 | delta?: Cohere.ChatContentDeltaEventDelta; 13 | logprobs?: Cohere.LogprobItem; 14 | } 15 | -------------------------------------------------------------------------------- /src/api/types/ChatContentDeltaEventDelta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatContentDeltaEventDelta { 8 | message?: Cohere.ChatContentDeltaEventDeltaMessage; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatContentDeltaEventDeltaMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatContentDeltaEventDeltaMessage { 8 | content?: Cohere.ChatContentDeltaEventDeltaMessageContent; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatContentDeltaEventDeltaMessageContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ChatContentDeltaEventDeltaMessageContent { 6 | text?: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/api/types/ChatContentEndEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed delta event which signifies that the content block has ended. 9 | */ 10 | export interface ChatContentEndEvent extends Cohere.ChatStreamEventType { 11 | index?: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ChatContentStartEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed delta event which signifies that a new content block has started. 9 | */ 10 | export interface ChatContentStartEvent extends Cohere.ChatStreamEventType { 11 | index?: number; 12 | delta?: Cohere.ChatContentStartEventDelta; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/ChatContentStartEventDelta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatContentStartEventDelta { 8 | message?: Cohere.ChatContentStartEventDeltaMessage; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatContentStartEventDeltaMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatContentStartEventDeltaMessage { 8 | content?: Cohere.ChatContentStartEventDeltaMessageContent; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatContentStartEventDeltaMessageContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ChatContentStartEventDeltaMessageContent { 6 | text?: string; 7 | type?: "text"; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/ChatDataMetrics.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ChatDataMetrics { 6 | /** The sum of all turns of valid train examples. */ 7 | numTrainTurns?: number; 8 | /** The sum of all turns of valid eval examples. */ 9 | numEvalTurns?: number; 10 | /** The preamble of this dataset. */ 11 | preamble?: string; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ChatDebugEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatDebugEvent extends Cohere.ChatStreamEvent { 8 | prompt?: string; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatDocument.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Relevant information that could be used by the model to generate a more accurate reply. 7 | * The contents of each document are generally short (under 300 words), and are passed in the form of a 8 | * dictionary of strings. Some suggested keys are "text", "author", "date". Both the key name and the value will be 9 | * passed to the model. 10 | */ 11 | export type ChatDocument = Record; 12 | -------------------------------------------------------------------------------- /src/api/types/ChatMessageEndEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed event which signifies that the chat message has ended. 9 | */ 10 | export interface ChatMessageEndEvent extends Cohere.ChatStreamEventType { 11 | id?: string; 12 | delta?: Cohere.ChatMessageEndEventDelta; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/ChatMessageEndEventDelta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatMessageEndEventDelta { 8 | finishReason?: Cohere.ChatFinishReason; 9 | usage?: Cohere.Usage; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/ChatMessageStartEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed event which signifies that a stream has started. 9 | */ 10 | export interface ChatMessageStartEvent extends Cohere.ChatStreamEventType { 11 | /** Unique identifier for the generated reply. */ 12 | id?: string; 13 | delta?: Cohere.ChatMessageStartEventDelta; 14 | } 15 | -------------------------------------------------------------------------------- /src/api/types/ChatMessageStartEventDelta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatMessageStartEventDelta { 8 | message?: Cohere.ChatMessageStartEventDeltaMessage; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatMessageStartEventDeltaMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ChatMessageStartEventDeltaMessage { 6 | /** The role of the message. */ 7 | role?: "assistant"; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/ChatMessages.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A list of chat messages in chronological order, representing a conversation between the user and the model. 9 | * 10 | * Messages can be from `User`, `Assistant`, `Tool` and `System` roles. Learn more about messages and roles in [the Chat API guide](https://docs.cohere.com/v2/docs/chat-api). 11 | */ 12 | export type ChatMessages = Cohere.ChatMessageV2[]; 13 | -------------------------------------------------------------------------------- /src/api/types/ChatRequestCitationQuality.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Defaults to `"accurate"`. 7 | * 8 | * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. 9 | * 10 | * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments 11 | */ 12 | export type ChatRequestCitationQuality = "fast" | "accurate" | "off"; 13 | export const ChatRequestCitationQuality = { 14 | Fast: "fast", 15 | Accurate: "accurate", 16 | Off: "off", 17 | } as const; 18 | -------------------------------------------------------------------------------- /src/api/types/ChatResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatResponse { 8 | /** Unique identifier for the generated reply. Useful for submitting feedback. */ 9 | id: string; 10 | finishReason: Cohere.ChatFinishReason; 11 | /** The prompt that was used. Only present when `return_prompt` in the request is set to true. */ 12 | prompt?: string; 13 | message: Cohere.AssistantMessageResponse; 14 | usage?: Cohere.Usage; 15 | logprobs?: Cohere.LogprobItem[]; 16 | } 17 | -------------------------------------------------------------------------------- /src/api/types/ChatSearchQueriesGenerationEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatSearchQueriesGenerationEvent extends Cohere.ChatStreamEvent { 8 | /** Generated search queries, meant to be used as part of the RAG flow. */ 9 | searchQueries: Cohere.ChatSearchQuery[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/ChatSearchQuery.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The generated search query. Contains the text of the query and a unique identifier for the query. 7 | */ 8 | export interface ChatSearchQuery { 9 | /** The text of the search query. */ 10 | text: string; 11 | /** Unique identifier for the generated search query. Useful for submitting feedback. */ 12 | generationId: string; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/ChatSearchResult.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatSearchResult { 8 | searchQuery?: Cohere.ChatSearchQuery; 9 | /** The connector from which this result comes from. */ 10 | connector: Cohere.ChatSearchResultConnector; 11 | /** Identifiers of documents found by this search query. */ 12 | documentIds: string[]; 13 | /** An error message if the search failed. */ 14 | errorMessage?: string; 15 | /** Whether a chat request should continue or not if the request to this connector fails. */ 16 | continueOnFailure?: boolean; 17 | } 18 | -------------------------------------------------------------------------------- /src/api/types/ChatSearchResultConnector.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The connector used for fetching documents. 7 | */ 8 | export interface ChatSearchResultConnector { 9 | /** The identifier of the connector. */ 10 | id: string; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/ChatSearchResultsEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatSearchResultsEvent extends Cohere.ChatStreamEvent { 8 | /** Conducted searches and the ids of documents retrieved from each of them. */ 9 | searchResults?: Cohere.ChatSearchResult[]; 10 | /** Documents fetched from searches or provided by the user. */ 11 | documents?: Cohere.ChatDocument[]; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ChatStreamEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ChatStreamEvent {} 6 | -------------------------------------------------------------------------------- /src/api/types/ChatStreamEventType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The streamed event types 7 | */ 8 | export interface ChatStreamEventType {} 9 | -------------------------------------------------------------------------------- /src/api/types/ChatStreamRequestCitationQuality.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Defaults to `"accurate"`. 7 | * 8 | * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. 9 | * 10 | * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments 11 | */ 12 | export type ChatStreamRequestCitationQuality = "fast" | "accurate" | "off"; 13 | export const ChatStreamRequestCitationQuality = { 14 | Fast: "fast", 15 | Accurate: "accurate", 16 | Off: "off", 17 | } as const; 18 | -------------------------------------------------------------------------------- /src/api/types/ChatStreamStartEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatStreamStartEvent extends Cohere.ChatStreamEvent { 8 | /** Unique identifier for the generated reply. Useful for submitting feedback. */ 9 | generationId: string; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/ChatTextGenerationEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatTextGenerationEvent extends Cohere.ChatStreamEvent { 8 | /** The next batch of text generated by the model. */ 9 | text: string; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallDeltaEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed event delta which signifies a delta in tool call arguments. 9 | */ 10 | export interface ChatToolCallDeltaEvent extends Cohere.ChatStreamEventType { 11 | index?: number; 12 | delta?: Cohere.ChatToolCallDeltaEventDelta; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallDeltaEventDelta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatToolCallDeltaEventDelta { 8 | message?: Cohere.ChatToolCallDeltaEventDeltaMessage; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallDeltaEventDeltaMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatToolCallDeltaEventDeltaMessage { 8 | toolCalls?: Cohere.ChatToolCallDeltaEventDeltaMessageToolCalls; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallDeltaEventDeltaMessageToolCalls.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatToolCallDeltaEventDeltaMessageToolCalls { 8 | function?: Cohere.ChatToolCallDeltaEventDeltaMessageToolCallsFunction; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallDeltaEventDeltaMessageToolCallsFunction.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ChatToolCallDeltaEventDeltaMessageToolCallsFunction { 6 | arguments?: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallEndEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed event delta which signifies a tool call has finished streaming. 9 | */ 10 | export interface ChatToolCallEndEvent extends Cohere.ChatStreamEventType { 11 | index?: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallStartEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed event delta which signifies a tool call has started streaming. 9 | */ 10 | export interface ChatToolCallStartEvent extends Cohere.ChatStreamEventType { 11 | index?: number; 12 | delta?: Cohere.ChatToolCallStartEventDelta; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallStartEventDelta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatToolCallStartEventDelta { 8 | message?: Cohere.ChatToolCallStartEventDeltaMessage; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallStartEventDeltaMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatToolCallStartEventDeltaMessage { 8 | toolCalls?: Cohere.ToolCallV2; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallsChunkEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatToolCallsChunkEvent extends Cohere.ChatStreamEvent { 8 | toolCallDelta: Cohere.ToolCallDelta; 9 | text?: string; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/ChatToolCallsGenerationEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatToolCallsGenerationEvent extends Cohere.ChatStreamEvent { 8 | /** The text generated related to the tool calls generated */ 9 | text?: string; 10 | toolCalls: Cohere.ToolCall[]; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/ChatToolPlanDeltaEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed event which contains a delta of tool plan text. 9 | */ 10 | export interface ChatToolPlanDeltaEvent extends Cohere.ChatStreamEventType { 11 | delta?: Cohere.ChatToolPlanDeltaEventDelta; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ChatToolPlanDeltaEventDelta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ChatToolPlanDeltaEventDelta { 8 | message?: Cohere.ChatToolPlanDeltaEventDeltaMessage; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ChatToolPlanDeltaEventDeltaMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ChatToolPlanDeltaEventDeltaMessage { 6 | toolPlan?: string; 7 | } 8 | -------------------------------------------------------------------------------- /src/api/types/CheckApiKeyResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface CheckApiKeyResponse { 6 | valid: boolean; 7 | organizationId?: string; 8 | ownerId?: string; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/Citation.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * Citation information containing sources and the text cited. 9 | */ 10 | export interface Citation { 11 | /** Start index of the cited snippet in the original source text. */ 12 | start?: number; 13 | /** End index of the cited snippet in the original source text. */ 14 | end?: number; 15 | /** Text snippet that is being cited. */ 16 | text?: string; 17 | sources?: Cohere.Source[]; 18 | type?: Cohere.CitationType; 19 | } 20 | -------------------------------------------------------------------------------- /src/api/types/CitationEndEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed event which signifies a citation has finished streaming. 9 | */ 10 | export interface CitationEndEvent extends Cohere.ChatStreamEventType { 11 | index?: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/CitationOptions.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * Options for controlling citation generation. 9 | */ 10 | export interface CitationOptions { 11 | /** 12 | * Defaults to `"accurate"`. 13 | * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. 14 | * 15 | * **Note**: `command-r7b-12-2024` and `command-a-03-2025` only support `"fast"` and `"off"` modes. The default is `"fast"`. 16 | */ 17 | mode?: Cohere.CitationOptionsMode; 18 | } 19 | -------------------------------------------------------------------------------- /src/api/types/CitationOptionsMode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Defaults to `"accurate"`. 7 | * Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results. 8 | * 9 | * **Note**: `command-r7b-12-2024` and `command-a-03-2025` only support `"fast"` and `"off"` modes. The default is `"fast"`. 10 | */ 11 | export type CitationOptionsMode = "FAST" | "ACCURATE" | "OFF"; 12 | export const CitationOptionsMode = { 13 | Fast: "FAST", 14 | Accurate: "ACCURATE", 15 | Off: "OFF", 16 | } as const; 17 | -------------------------------------------------------------------------------- /src/api/types/CitationStartEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A streamed event which signifies a citation has been created. 9 | */ 10 | export interface CitationStartEvent extends Cohere.ChatStreamEventType { 11 | index?: number; 12 | delta?: Cohere.CitationStartEventDelta; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/CitationStartEventDelta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface CitationStartEventDelta { 8 | message?: Cohere.CitationStartEventDeltaMessage; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/CitationStartEventDeltaMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface CitationStartEventDeltaMessage { 8 | citations?: Cohere.Citation; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/CitationType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The type of citation which indicates what part of the response the citation is for. 7 | */ 8 | export type CitationType = "TEXT_CONTENT" | "PLAN"; 9 | export const CitationType = { 10 | TextContent: "TEXT_CONTENT", 11 | Plan: "PLAN", 12 | } as const; 13 | -------------------------------------------------------------------------------- /src/api/types/ClassifyDataMetrics.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ClassifyDataMetrics { 8 | labelMetrics?: Cohere.LabelMetric[]; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ClassifyExample.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ClassifyExample { 6 | text?: string; 7 | label?: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/ClassifyResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ClassifyResponse { 8 | id: string; 9 | classifications: Cohere.ClassifyResponseClassificationsItem[]; 10 | meta?: Cohere.ApiMeta; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/ClassifyResponseClassificationsItemClassificationType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The type of classification performed 7 | */ 8 | export type ClassifyResponseClassificationsItemClassificationType = "single-label" | "multi-label"; 9 | export const ClassifyResponseClassificationsItemClassificationType = { 10 | SingleLabel: "single-label", 11 | MultiLabel: "multi-label", 12 | } as const; 13 | -------------------------------------------------------------------------------- /src/api/types/ClassifyResponseClassificationsItemLabelsValue.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ClassifyResponseClassificationsItemLabelsValue { 6 | confidence?: number; 7 | } 8 | -------------------------------------------------------------------------------- /src/api/types/CompatibleEndpoint.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * One of the Cohere API endpoints that the model can be used with. 7 | */ 8 | export type CompatibleEndpoint = "chat" | "embed" | "classify" | "summarize" | "rerank" | "rate" | "generate"; 9 | export const CompatibleEndpoint = { 10 | Chat: "chat", 11 | Embed: "embed", 12 | Classify: "classify", 13 | Summarize: "summarize", 14 | Rerank: "rerank", 15 | Rate: "rate", 16 | Generate: "generate", 17 | } as const; 18 | -------------------------------------------------------------------------------- /src/api/types/ConnectorAuthStatus.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The OAuth status for the user making the request. One of ["valid", "expired", ""]. Empty string (field is omitted) means the user has not authorized the connector yet. 7 | */ 8 | export type ConnectorAuthStatus = "valid" | "expired"; 9 | export const ConnectorAuthStatus = { 10 | Valid: "valid", 11 | Expired: "expired", 12 | } as const; 13 | -------------------------------------------------------------------------------- /src/api/types/ConnectorOAuth.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ConnectorOAuth { 6 | /** The OAuth 2.0 client ID. This field is encrypted at rest. */ 7 | clientId?: string; 8 | /** The OAuth 2.0 client Secret. This field is encrypted at rest and never returned in a response. */ 9 | clientSecret?: string; 10 | /** The OAuth 2.0 /authorize endpoint to use when users authorize the connector. */ 11 | authorizeUrl: string; 12 | /** The OAuth 2.0 /token endpoint to use when users authorize the connector. */ 13 | tokenUrl: string; 14 | /** The OAuth scopes to request when users authorize the connector. */ 15 | scope?: string; 16 | } 17 | -------------------------------------------------------------------------------- /src/api/types/Content.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A Content block which contains information about the content type and the content itself. 9 | */ 10 | export type Content = Cohere.Content.Text | Cohere.Content.ImageUrl; 11 | 12 | export namespace Content { 13 | export interface Text extends Cohere.TextContent { 14 | type: "text"; 15 | } 16 | 17 | export interface ImageUrl extends Cohere.ImageContent { 18 | type: "image_url"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/api/types/CreateConnectorResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface CreateConnectorResponse { 8 | connector: Cohere.Connector; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/CreateConnectorServiceAuth.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface CreateConnectorServiceAuth { 8 | type: Cohere.AuthTokenType; 9 | /** The token that will be used in the HTTP Authorization header when making requests to the connector. This field is encrypted at rest and never returned in a response. */ 10 | token: string; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/CreateEmbedJobResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * Response from creating an embed job. 9 | */ 10 | export interface CreateEmbedJobResponse { 11 | jobId: string; 12 | meta?: Cohere.ApiMeta; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/DatasetPart.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface DatasetPart { 6 | /** The dataset part ID */ 7 | id: string; 8 | /** The name of the dataset part */ 9 | name: string; 10 | /** The download url of the file */ 11 | url?: string; 12 | /** The index of the file */ 13 | index?: number; 14 | /** The size of the file in bytes */ 15 | sizeBytes?: number; 16 | /** The number of rows in the file */ 17 | numRows?: number; 18 | /** The download url of the original file */ 19 | originalUrl?: string; 20 | /** The first few rows of the parsed file */ 21 | samples?: string[]; 22 | } 23 | -------------------------------------------------------------------------------- /src/api/types/DatasetValidationStatus.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The validation status of the dataset 7 | */ 8 | export type DatasetValidationStatus = "unknown" | "queued" | "processing" | "failed" | "validated" | "skipped"; 9 | export const DatasetValidationStatus = { 10 | Unknown: "unknown", 11 | Queued: "queued", 12 | Processing: "processing", 13 | Failed: "failed", 14 | Validated: "validated", 15 | Skipped: "skipped", 16 | } as const; 17 | -------------------------------------------------------------------------------- /src/api/types/DeleteConnectorResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export type DeleteConnectorResponse = Record; 6 | -------------------------------------------------------------------------------- /src/api/types/DetokenizeResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface DetokenizeResponse { 8 | /** A string representing the list of tokens. */ 9 | text: string; 10 | meta?: Cohere.ApiMeta; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/DocumentContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * Document content. 9 | */ 10 | export interface DocumentContent { 11 | document: Cohere.Document; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/DocumentSource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * A document source object containing the unique identifier of the document and the document itself. 7 | */ 8 | export interface DocumentSource { 9 | /** The unique identifier of the document */ 10 | id?: string; 11 | document?: Record; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/EmbedByTypeResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface EmbedByTypeResponse { 8 | id: string; 9 | /** An object with different embedding types. The length of each embedding type array will be the same as the length of the original `texts` array. */ 10 | embeddings: Cohere.EmbedByTypeResponseEmbeddings; 11 | /** The text entries for which embeddings were returned. */ 12 | texts: string[]; 13 | /** The image entries for which embeddings were returned. */ 14 | images?: Cohere.Image[]; 15 | meta?: Cohere.ApiMeta; 16 | } 17 | -------------------------------------------------------------------------------- /src/api/types/EmbedContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export type EmbedContent = Cohere.EmbedContent.ImageUrl | Cohere.EmbedContent.Text; 8 | 9 | export namespace EmbedContent { 10 | export interface ImageUrl extends Cohere.EmbedImage { 11 | type: "image_url"; 12 | } 13 | 14 | export interface Text extends Cohere.EmbedText { 15 | type: "text"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/api/types/EmbedFloatsResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface EmbedFloatsResponse { 8 | id: string; 9 | /** An array of embeddings, where each embedding is an array of floats. The length of the `embeddings` array will be the same as the length of the original `texts` array. */ 10 | embeddings: number[][]; 11 | /** The text entries for which embeddings were returned. */ 12 | texts: string[]; 13 | /** The image entries for which embeddings were returned. */ 14 | images?: Cohere.Image[]; 15 | meta?: Cohere.ApiMeta; 16 | } 17 | -------------------------------------------------------------------------------- /src/api/types/EmbedImage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * Image content of the input. 9 | */ 10 | export interface EmbedImage { 11 | imageUrl?: Cohere.EmbedImageUrl; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/EmbedImageUrl.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Base64 url of image. 7 | */ 8 | export interface EmbedImageUrl { 9 | url: string; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/EmbedInput.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface EmbedInput { 8 | /** An array of objects containing the input data for the model to embed. */ 9 | content: Cohere.EmbedContent[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/EmbedJobStatus.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The status of the embed job 7 | */ 8 | export type EmbedJobStatus = "processing" | "complete" | "cancelling" | "cancelled" | "failed"; 9 | export const EmbedJobStatus = { 10 | Processing: "processing", 11 | Complete: "complete", 12 | Cancelling: "cancelling", 13 | Cancelled: "cancelled", 14 | Failed: "failed", 15 | } as const; 16 | -------------------------------------------------------------------------------- /src/api/types/EmbedJobTruncate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The truncation option used 7 | */ 8 | export type EmbedJobTruncate = "START" | "END"; 9 | export const EmbedJobTruncate = { 10 | Start: "START", 11 | End: "END", 12 | } as const; 13 | -------------------------------------------------------------------------------- /src/api/types/EmbedResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export type EmbedResponse = Cohere.EmbedResponse.EmbeddingsFloats | Cohere.EmbedResponse.EmbeddingsByType; 8 | 9 | export namespace EmbedResponse { 10 | export interface EmbeddingsFloats extends Cohere.EmbedFloatsResponse { 11 | responseType: "embeddings_floats"; 12 | } 13 | 14 | export interface EmbeddingsByType extends Cohere.EmbedByTypeResponse { 15 | responseType: "embeddings_by_type"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/api/types/EmbedText.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Text content of the input. 7 | */ 8 | export interface EmbedText { 9 | text?: string; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/EmbeddingType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export type EmbeddingType = "float" | "int8" | "uint8" | "binary" | "ubinary"; 6 | export const EmbeddingType = { 7 | Float: "float", 8 | Int8: "int8", 9 | Uint8: "uint8", 10 | Binary: "binary", 11 | Ubinary: "ubinary", 12 | } as const; 13 | -------------------------------------------------------------------------------- /src/api/types/FinetuneDatasetMetrics.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface FinetuneDatasetMetrics { 6 | /** The number of tokens of valid examples that can be used for training. */ 7 | trainableTokenCount?: number; 8 | /** The overall number of examples. */ 9 | totalExamples?: number; 10 | /** The number of training examples. */ 11 | trainExamples?: number; 12 | /** The size in bytes of all training examples. */ 13 | trainSizeBytes?: number; 14 | /** Number of evaluation examples. */ 15 | evalExamples?: number; 16 | /** The size in bytes of all eval examples. */ 17 | evalSizeBytes?: number; 18 | } 19 | -------------------------------------------------------------------------------- /src/api/types/FinishReason.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export type FinishReason = 6 | | "COMPLETE" 7 | | "STOP_SEQUENCE" 8 | | "ERROR" 9 | | "ERROR_TOXIC" 10 | | "ERROR_LIMIT" 11 | | "USER_CANCEL" 12 | | "MAX_TOKENS"; 13 | export const FinishReason = { 14 | Complete: "COMPLETE", 15 | StopSequence: "STOP_SEQUENCE", 16 | Error: "ERROR", 17 | ErrorToxic: "ERROR_TOXIC", 18 | ErrorLimit: "ERROR_LIMIT", 19 | UserCancel: "USER_CANCEL", 20 | MaxTokens: "MAX_TOKENS", 21 | } as const; 22 | -------------------------------------------------------------------------------- /src/api/types/GenerateRequestReturnLikelihoods.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. 7 | * 8 | * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. 9 | * 10 | * WARNING: `ALL` is deprecated, and will be removed in a future release. 11 | */ 12 | export type GenerateRequestReturnLikelihoods = "GENERATION" | "ALL" | "NONE"; 13 | export const GenerateRequestReturnLikelihoods = { 14 | Generation: "GENERATION", 15 | All: "ALL", 16 | None: "NONE", 17 | } as const; 18 | -------------------------------------------------------------------------------- /src/api/types/GenerateStreamEnd.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface GenerateStreamEnd extends Cohere.GenerateStreamEvent { 8 | isFinished: boolean; 9 | finishReason?: Cohere.FinishReason; 10 | response: Cohere.GenerateStreamEndResponse; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/GenerateStreamEndResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface GenerateStreamEndResponse { 8 | id: string; 9 | prompt?: string; 10 | generations?: Cohere.SingleGenerationInStream[]; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/GenerateStreamError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface GenerateStreamError extends Cohere.GenerateStreamEvent { 8 | /** Refers to the nth generation. Only present when `num_generations` is greater than zero. */ 9 | index?: number; 10 | isFinished: boolean; 11 | finishReason: Cohere.FinishReason; 12 | /** Error message */ 13 | err: string; 14 | } 15 | -------------------------------------------------------------------------------- /src/api/types/GenerateStreamEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface GenerateStreamEvent {} 6 | -------------------------------------------------------------------------------- /src/api/types/GenerateStreamRequestReturnLikelihoods.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * One of `GENERATION|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`. 7 | * 8 | * If `GENERATION` is selected, the token likelihoods will only be provided for generated text. 9 | * 10 | * WARNING: `ALL` is deprecated, and will be removed in a future release. 11 | */ 12 | export type GenerateStreamRequestReturnLikelihoods = "GENERATION" | "ALL" | "NONE"; 13 | export const GenerateStreamRequestReturnLikelihoods = { 14 | Generation: "GENERATION", 15 | All: "ALL", 16 | None: "NONE", 17 | } as const; 18 | -------------------------------------------------------------------------------- /src/api/types/GenerateStreamText.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface GenerateStreamText extends Cohere.GenerateStreamEvent { 8 | /** A segment of text of the generation. */ 9 | text: string; 10 | /** Refers to the nth generation. Only present when `num_generations` is greater than zero, and only when text responses are being streamed. */ 11 | index?: number; 12 | isFinished: boolean; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/Generation.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface Generation { 8 | id: string; 9 | /** Prompt used for generations. */ 10 | prompt?: string; 11 | /** List of generated results */ 12 | generations: Cohere.SingleGeneration[]; 13 | meta?: Cohere.ApiMeta; 14 | } 15 | -------------------------------------------------------------------------------- /src/api/types/GetConnectorResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface GetConnectorResponse { 8 | connector: Cohere.Connector; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/Image.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface Image { 6 | /** Width of the image in pixels */ 7 | width: number; 8 | /** Height of the image in pixels */ 9 | height: number; 10 | /** Format of the image */ 11 | format: string; 12 | /** Bit depth of the image */ 13 | bitDepth: number; 14 | } 15 | -------------------------------------------------------------------------------- /src/api/types/ImageContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * Image content of the message. 9 | */ 10 | export interface ImageContent { 11 | imageUrl: Cohere.ImageUrl; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ImageUrl.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Base64 url of image. 7 | */ 8 | export interface ImageUrl { 9 | url: string; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/LabelMetric.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface LabelMetric { 6 | /** Total number of examples for this label */ 7 | totalExamples?: number; 8 | /** value of the label */ 9 | label?: string; 10 | /** samples for this label */ 11 | samples?: string[]; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ListConnectorsResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ListConnectorsResponse { 8 | connectors: Cohere.Connector[]; 9 | /** Total number of connectors. */ 10 | totalCount?: number; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/ListEmbedJobResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ListEmbedJobResponse { 8 | embedJobs?: Cohere.EmbedJob[]; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ListModelsResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ListModelsResponse { 8 | models: Cohere.GetModelResponse[]; 9 | /** A token to retrieve the next page of results. Provide in the page_token parameter of the next request. */ 10 | nextPageToken?: string; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/LogprobItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface LogprobItem { 6 | /** The text chunk for which the log probabilities was calculated. */ 7 | text?: string; 8 | /** The token ids of each token used to construct the text chunk. */ 9 | tokenIds: number[]; 10 | /** The log probability of each token used to construct the text chunk. */ 11 | logprobs?: number[]; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/Message.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export type Message = Cohere.Message.Chatbot | Cohere.Message.System | Cohere.Message.User | Cohere.Message.Tool; 8 | 9 | export namespace Message { 10 | export interface Chatbot extends Cohere.ChatMessage { 11 | role: "CHATBOT"; 12 | } 13 | 14 | export interface System extends Cohere.ChatMessage { 15 | role: "SYSTEM"; 16 | } 17 | 18 | export interface User extends Cohere.ChatMessage { 19 | role: "USER"; 20 | } 21 | 22 | export interface Tool extends Cohere.ToolMessage { 23 | role: "TOOL"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/api/types/Metrics.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface Metrics { 8 | finetuneDatasetMetrics?: Cohere.FinetuneDatasetMetrics; 9 | embedData?: Cohere.MetricsEmbedData; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/MetricsEmbedData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface MetricsEmbedData { 8 | /** the fields in the dataset */ 9 | fields?: Cohere.MetricsEmbedDataFieldsItem[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/MetricsEmbedDataFieldsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface MetricsEmbedDataFieldsItem { 6 | /** the name of the field */ 7 | name?: string; 8 | /** the number of times the field appears in the dataset */ 9 | count?: number; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/OAuthAuthorizeResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface OAuthAuthorizeResponse { 6 | /** The OAuth 2.0 redirect url. Redirect the user to this url to authorize the connector. */ 7 | redirectUrl?: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/ParseInfo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ParseInfo { 6 | separator?: string; 7 | delimiter?: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/ReasoningEffort.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The reasoning effort level of the model. This affects the model's performance and the time it takes to generate a response. 7 | */ 8 | export type ReasoningEffort = "low" | "medium" | "high"; 9 | export const ReasoningEffort = { 10 | Low: "low", 11 | Medium: "medium", 12 | High: "high", 13 | } as const; 14 | -------------------------------------------------------------------------------- /src/api/types/RerankDocument.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export type RerankDocument = Record; 6 | -------------------------------------------------------------------------------- /src/api/types/RerankRequestDocumentsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export type RerankRequestDocumentsItem = string | Cohere.RerankDocument; 8 | -------------------------------------------------------------------------------- /src/api/types/RerankResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface RerankResponse { 8 | id?: string; 9 | /** An ordered list of ranked documents */ 10 | results: Cohere.RerankResponseResultsItem[]; 11 | meta?: Cohere.ApiMeta; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/RerankResponseResultsItemDocument.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * If `return_documents` is set as `false` this will return none, if `true` it will return the documents passed in 7 | */ 8 | export interface RerankResponseResultsItemDocument { 9 | /** The text of the document to rerank */ 10 | text: string; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/SingleGenerationInStream.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface SingleGenerationInStream { 8 | id: string; 9 | /** Full text of the generation. */ 10 | text: string; 11 | /** Refers to the nth generation. Only present when `num_generations` is greater than zero. */ 12 | index?: number; 13 | finishReason: Cohere.FinishReason; 14 | } 15 | -------------------------------------------------------------------------------- /src/api/types/SingleGenerationTokenLikelihoodsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface SingleGenerationTokenLikelihoodsItem { 6 | token: string; 7 | likelihood: number; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/Source.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A source object containing information about the source of the data cited. 9 | */ 10 | export type Source = Cohere.Source.Tool | Cohere.Source.Document; 11 | 12 | export namespace Source { 13 | export interface Tool extends Cohere.ToolSource { 14 | type: "tool"; 15 | } 16 | 17 | export interface Document extends Cohere.DocumentSource { 18 | type: "document"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/api/types/SummarizeRequestExtractiveness.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text. 7 | */ 8 | export type SummarizeRequestExtractiveness = "low" | "medium" | "high"; 9 | export const SummarizeRequestExtractiveness = { 10 | Low: "low", 11 | Medium: "medium", 12 | High: "high", 13 | } as const; 14 | -------------------------------------------------------------------------------- /src/api/types/SummarizeRequestFormat.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If `auto` is selected, the best option will be picked based on the input text. 7 | */ 8 | export type SummarizeRequestFormat = "paragraph" | "bullets"; 9 | export const SummarizeRequestFormat = { 10 | Paragraph: "paragraph", 11 | Bullets: "bullets", 12 | } as const; 13 | -------------------------------------------------------------------------------- /src/api/types/SummarizeRequestLength.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * One of `short`, `medium`, `long`, or `auto` defaults to `auto`. Indicates the approximate length of the summary. If `auto` is selected, the best option will be picked based on the input text. 7 | */ 8 | export type SummarizeRequestLength = "short" | "medium" | "long"; 9 | export const SummarizeRequestLength = { 10 | Short: "short", 11 | Medium: "medium", 12 | Long: "long", 13 | } as const; 14 | -------------------------------------------------------------------------------- /src/api/types/SummarizeResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface SummarizeResponse { 8 | /** Generated ID for the summary */ 9 | id?: string; 10 | /** Generated summary for the text */ 11 | summary?: string; 12 | meta?: Cohere.ApiMeta; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/SystemMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A message from the system. 9 | */ 10 | export interface SystemMessage { 11 | content: Cohere.SystemMessageContent; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/SystemMessageContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export type SystemMessageContent = string | Cohere.SystemMessageContentItem[]; 8 | -------------------------------------------------------------------------------- /src/api/types/SystemMessageContentItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export type SystemMessageContentItem = Cohere.SystemMessageContentItem.Text; 8 | 9 | export namespace SystemMessageContentItem { 10 | export interface Text extends Cohere.TextContent { 11 | type: "text"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/TextContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Text content of the message. 7 | */ 8 | export interface TextContent { 9 | text: string; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/TextResponseFormat.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface TextResponseFormat {} 6 | -------------------------------------------------------------------------------- /src/api/types/TextResponseFormatV2.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface TextResponseFormatV2 {} 6 | -------------------------------------------------------------------------------- /src/api/types/TokenizeResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface TokenizeResponse { 8 | /** An array of tokens, where each token is an integer. */ 9 | tokens: number[]; 10 | tokenStrings: string[]; 11 | meta?: Cohere.ApiMeta; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ToolCall.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Contains the tool calls generated by the model. Use it to invoke your tools. 7 | */ 8 | export interface ToolCall { 9 | /** Name of the tool to call. */ 10 | name: string; 11 | /** The name and value of the parameters to use when invoking a tool. */ 12 | parameters: Record; 13 | } 14 | -------------------------------------------------------------------------------- /src/api/types/ToolCallDelta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Contains the chunk of the tool call generation in the stream. 7 | */ 8 | export interface ToolCallDelta { 9 | /** Name of the tool call */ 10 | name?: string; 11 | /** Index of the tool call generated */ 12 | index?: number; 13 | /** Chunk of the tool parameters */ 14 | parameters?: string; 15 | /** Chunk of the tool plan text */ 16 | text?: string; 17 | } 18 | -------------------------------------------------------------------------------- /src/api/types/ToolCallV2.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * An array of tool calls to be made. 9 | */ 10 | export interface ToolCallV2 { 11 | id?: string; 12 | type?: "function"; 13 | function?: Cohere.ToolCallV2Function; 14 | } 15 | -------------------------------------------------------------------------------- /src/api/types/ToolCallV2Function.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ToolCallV2Function { 6 | name?: string; 7 | arguments?: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/api/types/ToolContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A content block which contains information about the content of a tool result 9 | */ 10 | export type ToolContent = Cohere.ToolContent.Text | Cohere.ToolContent.Document; 11 | 12 | export namespace ToolContent { 13 | export interface Text extends Cohere.TextContent { 14 | type: "text"; 15 | } 16 | 17 | export interface Document extends Cohere.DocumentContent { 18 | type: "document"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/api/types/ToolMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * Represents tool result in the chat history. 9 | */ 10 | export interface ToolMessage { 11 | toolResults?: Cohere.ToolResult[]; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ToolMessageV2.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A message with Tool outputs. 9 | */ 10 | export interface ToolMessageV2 { 11 | /** The id of the associated tool call that has provided the given content */ 12 | toolCallId: string; 13 | /** Outputs from a tool. The content should formatted as a JSON object string, or a list of tool content blocks */ 14 | content: Cohere.ToolMessageV2Content; 15 | } 16 | -------------------------------------------------------------------------------- /src/api/types/ToolMessageV2Content.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * Outputs from a tool. The content should formatted as a JSON object string, or a list of tool content blocks 9 | */ 10 | export type ToolMessageV2Content = string | Cohere.ToolContent[]; 11 | -------------------------------------------------------------------------------- /src/api/types/ToolParameterDefinitionsValue.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ToolParameterDefinitionsValue { 6 | /** The description of the parameter. */ 7 | description?: string; 8 | /** The type of the parameter. Must be a valid Python type. */ 9 | type: string; 10 | /** Denotes whether the parameter is always present (required) or not. Defaults to not required. */ 11 | required?: boolean; 12 | } 13 | -------------------------------------------------------------------------------- /src/api/types/ToolResult.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ToolResult { 8 | call: Cohere.ToolCall; 9 | outputs: Record[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/ToolSource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface ToolSource { 6 | /** The unique identifier of the document */ 7 | id?: string; 8 | toolOutput?: Record; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/ToolV2.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface ToolV2 { 8 | type?: "function"; 9 | /** The function to be executed. */ 10 | function?: Cohere.ToolV2Function; 11 | } 12 | -------------------------------------------------------------------------------- /src/api/types/ToolV2Function.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * The function to be executed. 7 | */ 8 | export interface ToolV2Function { 9 | /** The name of the function. */ 10 | name: string; 11 | /** The description of the function. */ 12 | description?: string; 13 | /** The parameters of the function as a JSON schema. */ 14 | parameters: Record; 15 | } 16 | -------------------------------------------------------------------------------- /src/api/types/TruncationStrategy.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * Describes the truncation strategy for when the prompt exceeds the context length. Defaults to 'none' 9 | */ 10 | export type TruncationStrategy = Cohere.TruncationStrategy.Auto | Cohere.TruncationStrategy.None; 11 | 12 | export namespace TruncationStrategy { 13 | export interface Auto extends Cohere.TruncationStrategyAutoPreserveOrder { 14 | type: "auto"; 15 | } 16 | 17 | export interface None extends Cohere.TruncationStrategyNone { 18 | type: "none"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/api/types/TruncationStrategyAutoPreserveOrder.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * If the prompt exceeds the context length, this truncation strategy will continuously omit the oldest tool call and tool result pairs until the prompt fits. If the prompt does not fit with only the last tool call and tool result pair, an error will be returned. 7 | */ 8 | export interface TruncationStrategyAutoPreserveOrder {} 9 | -------------------------------------------------------------------------------- /src/api/types/TruncationStrategyNone.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | /** 6 | * Prohibits any prompt truncation; if the context length is exceeded, an error will be returned. 7 | */ 8 | export interface TruncationStrategyNone {} 9 | -------------------------------------------------------------------------------- /src/api/types/UpdateConnectorResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface UpdateConnectorResponse { 8 | connector: Cohere.Connector; 9 | } 10 | -------------------------------------------------------------------------------- /src/api/types/Usage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | export interface Usage { 8 | billedUnits?: Cohere.UsageBilledUnits; 9 | tokens?: Cohere.UsageTokens; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/UsageBilledUnits.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface UsageBilledUnits { 6 | /** The number of billed input tokens. */ 7 | inputTokens?: number; 8 | /** The number of billed output tokens. */ 9 | outputTokens?: number; 10 | /** The number of billed search units. */ 11 | searchUnits?: number; 12 | /** The number of billed classifications units. */ 13 | classifications?: number; 14 | } 15 | -------------------------------------------------------------------------------- /src/api/types/UsageTokens.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export interface UsageTokens { 6 | /** The number of tokens used as input to the model. */ 7 | inputTokens?: number; 8 | /** The number of tokens produced by the model. */ 9 | outputTokens?: number; 10 | } 11 | -------------------------------------------------------------------------------- /src/api/types/UserMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * A message from the user. 9 | */ 10 | export interface UserMessage { 11 | /** 12 | * The content of the message. This can be a string or a list of content blocks. 13 | * If a string is provided, it will be treated as a text content block. 14 | */ 15 | content: Cohere.UserMessageContent; 16 | } 17 | -------------------------------------------------------------------------------- /src/api/types/UserMessageContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as Cohere from "../index"; 6 | 7 | /** 8 | * The content of the message. This can be a string or a list of content blocks. 9 | * If a string is provided, it will be treated as a text content block. 10 | */ 11 | export type UserMessageContent = string | Cohere.Content[]; 12 | -------------------------------------------------------------------------------- /src/core/auth/BearerToken.ts: -------------------------------------------------------------------------------- 1 | export type BearerToken = string; 2 | 3 | const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i; 4 | 5 | export const BearerToken = { 6 | toAuthorizationHeader: (token: BearerToken | undefined): string | undefined => { 7 | if (token == null) { 8 | return undefined; 9 | } 10 | return `Bearer ${token}`; 11 | }, 12 | fromAuthorizationHeader: (header: string): BearerToken => { 13 | return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim() as BearerToken; 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /src/core/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { BasicAuth } from "./BasicAuth"; 2 | export { BearerToken } from "./BearerToken"; 3 | -------------------------------------------------------------------------------- /src/core/fetcher/APIResponse.ts: -------------------------------------------------------------------------------- 1 | export type APIResponse = SuccessfulResponse | FailedResponse; 2 | 3 | export interface SuccessfulResponse { 4 | ok: true; 5 | body: T; 6 | headers?: Record; 7 | } 8 | 9 | export interface FailedResponse { 10 | ok: false; 11 | error: T; 12 | } 13 | -------------------------------------------------------------------------------- /src/core/fetcher/Supplier.ts: -------------------------------------------------------------------------------- 1 | export type Supplier = T | Promise | (() => T | Promise); 2 | 3 | export const Supplier = { 4 | get: async (supplier: Supplier): Promise => { 5 | if (typeof supplier === "function") { 6 | return (supplier as () => T)(); 7 | } else { 8 | return supplier; 9 | } 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /src/core/fetcher/createRequestUrl.ts: -------------------------------------------------------------------------------- 1 | import qs from "qs"; 2 | 3 | export function createRequestUrl( 4 | baseUrl: string, 5 | queryParameters?: Record 6 | ): string { 7 | return Object.keys(queryParameters ?? {}).length > 0 8 | ? `${baseUrl}?${qs.stringify(queryParameters, { arrayFormat: "repeat" })}` 9 | : baseUrl; 10 | } 11 | -------------------------------------------------------------------------------- /src/core/fetcher/getHeader.ts: -------------------------------------------------------------------------------- 1 | export function getHeader(headers: Record, header: string): string | undefined { 2 | for (const [headerKey, headerValue] of Object.entries(headers)) { 3 | if (headerKey.toLowerCase() === header.toLowerCase()) { 4 | return headerValue; 5 | } 6 | } 7 | return undefined; 8 | } 9 | -------------------------------------------------------------------------------- /src/core/fetcher/getRequestBody.ts: -------------------------------------------------------------------------------- 1 | export declare namespace GetRequestBody { 2 | interface Args { 3 | body: unknown; 4 | type: "json" | "file" | "bytes" | "other"; 5 | } 6 | } 7 | 8 | export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { 9 | if (type.includes("json")) { 10 | return JSON.stringify(body); 11 | } else { 12 | return body as BodyInit; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/core/fetcher/index.ts: -------------------------------------------------------------------------------- 1 | export type { APIResponse } from "./APIResponse"; 2 | export { fetcher } from "./Fetcher"; 3 | export type { Fetcher, FetchFunction } from "./Fetcher"; 4 | export { getHeader } from "./getHeader"; 5 | export { Supplier } from "./Supplier"; 6 | -------------------------------------------------------------------------------- /src/core/form-data-utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./FormDataWrapper"; 2 | -------------------------------------------------------------------------------- /src/core/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./fetcher"; 2 | export * from "./auth"; 3 | export * from "./streaming-fetcher"; 4 | export * from "./runtime"; 5 | export * from "./form-data-utils"; 6 | export * as serialization from "./schemas"; 7 | -------------------------------------------------------------------------------- /src/core/runtime/index.ts: -------------------------------------------------------------------------------- 1 | export { RUNTIME } from "./runtime"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/bigint/index.ts: -------------------------------------------------------------------------------- 1 | export { bigint } from "./bigint"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/date/index.ts: -------------------------------------------------------------------------------- 1 | export { date } from "./date"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/enum/index.ts: -------------------------------------------------------------------------------- 1 | export { enum_ } from "./enum"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./bigint"; 2 | export * from "./date"; 3 | export * from "./enum"; 4 | export * from "./lazy"; 5 | export * from "./list"; 6 | export * from "./literals"; 7 | export * from "./object"; 8 | export * from "./object-like"; 9 | export * from "./primitives"; 10 | export * from "./record"; 11 | export * from "./schema-utils"; 12 | export * from "./set"; 13 | export * from "./undiscriminated-union"; 14 | export * from "./union"; 15 | -------------------------------------------------------------------------------- /src/core/schemas/builders/lazy/index.ts: -------------------------------------------------------------------------------- 1 | export { lazy } from "./lazy"; 2 | export type { SchemaGetter } from "./lazy"; 3 | export { lazyObject } from "./lazyObject"; 4 | -------------------------------------------------------------------------------- /src/core/schemas/builders/list/index.ts: -------------------------------------------------------------------------------- 1 | export { list } from "./list"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/literals/index.ts: -------------------------------------------------------------------------------- 1 | export { stringLiteral } from "./stringLiteral"; 2 | export { booleanLiteral } from "./booleanLiteral"; 3 | -------------------------------------------------------------------------------- /src/core/schemas/builders/object-like/index.ts: -------------------------------------------------------------------------------- 1 | export { getObjectLikeUtils, withParsedProperties } from "./getObjectLikeUtils"; 2 | export type { ObjectLikeSchema, ObjectLikeUtils } from "./types"; 3 | -------------------------------------------------------------------------------- /src/core/schemas/builders/object-like/types.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema, Schema } from "../../Schema"; 2 | 3 | export type ObjectLikeSchema = Schema & 4 | BaseSchema & 5 | ObjectLikeUtils; 6 | 7 | export interface ObjectLikeUtils { 8 | withParsedProperties: >(properties: { 9 | [K in keyof T]: T[K] | ((parsed: Parsed) => T[K]); 10 | }) => ObjectLikeSchema; 11 | } 12 | -------------------------------------------------------------------------------- /src/core/schemas/builders/primitives/any.ts: -------------------------------------------------------------------------------- 1 | import { SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | 4 | export const any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value })); 5 | -------------------------------------------------------------------------------- /src/core/schemas/builders/primitives/index.ts: -------------------------------------------------------------------------------- 1 | export { any } from "./any"; 2 | export { boolean } from "./boolean"; 3 | export { number } from "./number"; 4 | export { string } from "./string"; 5 | export { unknown } from "./unknown"; 6 | -------------------------------------------------------------------------------- /src/core/schemas/builders/primitives/unknown.ts: -------------------------------------------------------------------------------- 1 | import { SchemaType } from "../../Schema"; 2 | import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; 3 | 4 | export const unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value })); 5 | -------------------------------------------------------------------------------- /src/core/schemas/builders/record/index.ts: -------------------------------------------------------------------------------- 1 | export { record } from "./record"; 2 | export type { BaseRecordSchema, RecordSchema } from "./types"; 3 | -------------------------------------------------------------------------------- /src/core/schemas/builders/record/types.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema } from "../../Schema"; 2 | import { SchemaUtils } from "../schema-utils"; 3 | 4 | export type RecordSchema< 5 | RawKey extends string | number, 6 | RawValue, 7 | ParsedKey extends string | number, 8 | ParsedValue 9 | > = BaseRecordSchema & 10 | SchemaUtils, Record>; 11 | 12 | export type BaseRecordSchema< 13 | RawKey extends string | number, 14 | RawValue, 15 | ParsedKey extends string | number, 16 | ParsedValue 17 | > = BaseSchema, Record>; 18 | -------------------------------------------------------------------------------- /src/core/schemas/builders/schema-utils/JsonError.ts: -------------------------------------------------------------------------------- 1 | import { ValidationError } from "../../Schema"; 2 | import { stringifyValidationError } from "./stringifyValidationErrors"; 3 | 4 | export class JsonError extends Error { 5 | constructor(public readonly errors: ValidationError[]) { 6 | super(errors.map(stringifyValidationError).join("; ")); 7 | Object.setPrototypeOf(this, JsonError.prototype); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/core/schemas/builders/schema-utils/ParseError.ts: -------------------------------------------------------------------------------- 1 | import { ValidationError } from "../../Schema"; 2 | import { stringifyValidationError } from "./stringifyValidationErrors"; 3 | 4 | export class ParseError extends Error { 5 | constructor(public readonly errors: ValidationError[]) { 6 | super(errors.map(stringifyValidationError).join("; ")); 7 | Object.setPrototypeOf(this, ParseError.prototype); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/core/schemas/builders/schema-utils/index.ts: -------------------------------------------------------------------------------- 1 | export { getSchemaUtils, optional, transform } from "./getSchemaUtils"; 2 | export type { SchemaUtils } from "./getSchemaUtils"; 3 | export { JsonError } from "./JsonError"; 4 | export { ParseError } from "./ParseError"; 5 | -------------------------------------------------------------------------------- /src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts: -------------------------------------------------------------------------------- 1 | import { ValidationError } from "../../Schema"; 2 | 3 | export function stringifyValidationError(error: ValidationError): string { 4 | if (error.path.length === 0) { 5 | return error.message; 6 | } 7 | return `${error.path.join(" -> ")}: ${error.message}`; 8 | } 9 | -------------------------------------------------------------------------------- /src/core/schemas/builders/set/index.ts: -------------------------------------------------------------------------------- 1 | export { set } from "./set"; 2 | -------------------------------------------------------------------------------- /src/core/schemas/builders/undiscriminated-union/index.ts: -------------------------------------------------------------------------------- 1 | export type { 2 | inferParsedUnidiscriminatedUnionSchema, 3 | inferRawUnidiscriminatedUnionSchema, 4 | UndiscriminatedUnionSchema, 5 | } from "./types"; 6 | export { undiscriminatedUnion } from "./undiscriminatedUnion"; 7 | -------------------------------------------------------------------------------- /src/core/schemas/builders/undiscriminated-union/types.ts: -------------------------------------------------------------------------------- 1 | import { inferParsed, inferRaw, Schema } from "../../Schema"; 2 | 3 | export type UndiscriminatedUnionSchema = Schema< 4 | inferRawUnidiscriminatedUnionSchema, 5 | inferParsedUnidiscriminatedUnionSchema 6 | >; 7 | 8 | export type inferRawUnidiscriminatedUnionSchema = inferRaw; 9 | 10 | export type inferParsedUnidiscriminatedUnionSchema = inferParsed; 11 | -------------------------------------------------------------------------------- /src/core/schemas/builders/union/discriminant.ts: -------------------------------------------------------------------------------- 1 | export function discriminant( 2 | parsedDiscriminant: ParsedDiscriminant, 3 | rawDiscriminant: RawDiscriminant 4 | ): Discriminant { 5 | return { 6 | parsedDiscriminant, 7 | rawDiscriminant, 8 | }; 9 | } 10 | 11 | export interface Discriminant { 12 | parsedDiscriminant: ParsedDiscriminant; 13 | rawDiscriminant: RawDiscriminant; 14 | } 15 | -------------------------------------------------------------------------------- /src/core/schemas/builders/union/index.ts: -------------------------------------------------------------------------------- 1 | export { discriminant } from "./discriminant"; 2 | export type { Discriminant } from "./discriminant"; 3 | export type { 4 | inferParsedDiscriminant, 5 | inferParsedUnion, 6 | inferRawDiscriminant, 7 | inferRawUnion, 8 | UnionSubtypes, 9 | } from "./types"; 10 | export { union } from "./union"; 11 | -------------------------------------------------------------------------------- /src/core/schemas/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./builders"; 2 | export type { inferParsed, inferRaw, Schema, SchemaOptions } from "./Schema"; 3 | -------------------------------------------------------------------------------- /src/core/schemas/utils/MaybePromise.ts: -------------------------------------------------------------------------------- 1 | export type MaybePromise = T | Promise; 2 | -------------------------------------------------------------------------------- /src/core/schemas/utils/addQuestionMarksToNullableProperties.ts: -------------------------------------------------------------------------------- 1 | export type addQuestionMarksToNullableProperties = { 2 | [K in OptionalKeys]?: T[K]; 3 | } & Pick>; 4 | 5 | export type OptionalKeys = { 6 | [K in keyof T]-?: undefined extends T[K] 7 | ? K 8 | : null extends T[K] 9 | ? K 10 | : 1 extends (any extends T[K] ? 0 : 1) 11 | ? never 12 | : K; 13 | }[keyof T]; 14 | 15 | export type RequiredKeys = Exclude>; 16 | -------------------------------------------------------------------------------- /src/core/schemas/utils/entries.ts: -------------------------------------------------------------------------------- 1 | export function entries(object: T): [keyof T, T[keyof T]][] { 2 | return Object.entries(object) as [keyof T, T[keyof T]][]; 3 | } 4 | -------------------------------------------------------------------------------- /src/core/schemas/utils/filterObject.ts: -------------------------------------------------------------------------------- 1 | export function filterObject(obj: T, keysToInclude: K[]): Pick { 2 | const keysToIncludeSet = new Set(keysToInclude); 3 | return Object.entries(obj).reduce((acc, [key, value]) => { 4 | if (keysToIncludeSet.has(key as K)) { 5 | acc[key as K] = value; 6 | } 7 | return acc; 8 | // eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter 9 | }, {} as Pick); 10 | } 11 | -------------------------------------------------------------------------------- /src/core/schemas/utils/isPlainObject.ts: -------------------------------------------------------------------------------- 1 | // borrowed from https://github.com/lodash/lodash/blob/master/isPlainObject.js 2 | export function isPlainObject(value: unknown): value is Record { 3 | if (typeof value !== "object" || value === null) { 4 | return false; 5 | } 6 | 7 | if (Object.getPrototypeOf(value) === null) { 8 | return true; 9 | } 10 | 11 | let proto = value; 12 | while (Object.getPrototypeOf(proto) !== null) { 13 | proto = Object.getPrototypeOf(proto); 14 | } 15 | 16 | return Object.getPrototypeOf(value) === proto; 17 | } 18 | -------------------------------------------------------------------------------- /src/core/schemas/utils/keys.ts: -------------------------------------------------------------------------------- 1 | export function keys(object: T): (keyof T)[] { 2 | return Object.keys(object) as (keyof T)[]; 3 | } 4 | -------------------------------------------------------------------------------- /src/core/schemas/utils/partition.ts: -------------------------------------------------------------------------------- 1 | export function partition(items: readonly T[], predicate: (item: T) => boolean): [T[], T[]] { 2 | const trueItems: T[] = [], 3 | falseItems: T[] = []; 4 | for (const item of items) { 5 | if (predicate(item)) { 6 | trueItems.push(item); 7 | } else { 8 | falseItems.push(item); 9 | } 10 | } 11 | return [trueItems, falseItems]; 12 | } 13 | -------------------------------------------------------------------------------- /src/core/streaming-fetcher/index.ts: -------------------------------------------------------------------------------- 1 | export { Stream } from "./Stream"; 2 | -------------------------------------------------------------------------------- /src/environments.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export const CohereEnvironment = { 6 | Production: "https://api.cohere.com", 7 | } as const; 8 | 9 | export type CohereEnvironment = typeof CohereEnvironment.Production; 10 | -------------------------------------------------------------------------------- /src/errors/CohereTimeoutError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | export class CohereTimeoutError extends Error { 6 | constructor(message: string) { 7 | super(message); 8 | Object.setPrototypeOf(this, CohereTimeoutError.prototype); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/errors/index.ts: -------------------------------------------------------------------------------- 1 | export { CohereError } from "./CohereError"; 2 | export { CohereTimeoutError } from "./CohereTimeoutError"; 3 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * as Cohere from "./api"; 2 | export { BedrockClient, BedrockClientV2 } from "./BedrockClient"; 3 | export { CohereClientV2 } from "./ClientV2"; 4 | export { CustomClient as CohereClient } from "./CustomClient"; 5 | export { CohereEnvironment } from "./environments"; 6 | export { CohereError, CohereTimeoutError } from "./errors"; 7 | export { SagemakerClient, SagemakerClientV2 } from "./SagemakerClient"; 8 | 9 | -------------------------------------------------------------------------------- /src/serialization/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/serialization/client/requests/DetokenizeRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../index"; 6 | import * as Cohere from "../../../api/index"; 7 | import * as core from "../../../core"; 8 | 9 | export const DetokenizeRequest: core.serialization.Schema = 10 | core.serialization.object({ 11 | tokens: core.serialization.list(core.serialization.number()), 12 | model: core.serialization.string(), 13 | }); 14 | 15 | export declare namespace DetokenizeRequest { 16 | interface Raw { 17 | tokens: number[]; 18 | model: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/client/requests/TokenizeRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../index"; 6 | import * as Cohere from "../../../api/index"; 7 | import * as core from "../../../core"; 8 | 9 | export const TokenizeRequest: core.serialization.Schema = 10 | core.serialization.object({ 11 | text: core.serialization.string(), 12 | model: core.serialization.string(), 13 | }); 14 | 15 | export declare namespace TokenizeRequest { 16 | interface Raw { 17 | text: string; 18 | model: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { ChatStreamRequest } from "./ChatStreamRequest"; 2 | export { ChatRequest } from "./ChatRequest"; 3 | export { GenerateStreamRequest } from "./GenerateStreamRequest"; 4 | export { GenerateRequest } from "./GenerateRequest"; 5 | export { EmbedRequest } from "./EmbedRequest"; 6 | export { RerankRequest } from "./RerankRequest"; 7 | export { ClassifyRequest } from "./ClassifyRequest"; 8 | export { SummarizeRequest } from "./SummarizeRequest"; 9 | export { TokenizeRequest } from "./TokenizeRequest"; 10 | export { DetokenizeRequest } from "./DetokenizeRequest"; 11 | -------------------------------------------------------------------------------- /src/serialization/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./resources"; 2 | export * from "./types"; 3 | export * from "./client"; 4 | -------------------------------------------------------------------------------- /src/serialization/resources/connectors/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/connectors/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { CreateConnectorRequest } from "./CreateConnectorRequest"; 2 | export { UpdateConnectorRequest } from "./UpdateConnectorRequest"; 3 | -------------------------------------------------------------------------------- /src/serialization/resources/connectors/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/datasets/client/delete.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as core from "../../../../core"; 7 | 8 | export const Response: core.serialization.Schema< 9 | serializers.datasets.delete.Response.Raw, 10 | Record 11 | > = core.serialization.record(core.serialization.string(), core.serialization.unknown()); 12 | 13 | export declare namespace Response { 14 | type Raw = Record; 15 | } 16 | -------------------------------------------------------------------------------- /src/serialization/resources/datasets/client/index.ts: -------------------------------------------------------------------------------- 1 | export * as delete from "./delete"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/datasets/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | export * from "./client"; 3 | -------------------------------------------------------------------------------- /src/serialization/resources/datasets/types/DatasetsCreateResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | 9 | export const DatasetsCreateResponse: core.serialization.ObjectSchema< 10 | serializers.DatasetsCreateResponse.Raw, 11 | Cohere.DatasetsCreateResponse 12 | > = core.serialization.object({ 13 | id: core.serialization.string().optional(), 14 | }); 15 | 16 | export declare namespace DatasetsCreateResponse { 17 | interface Raw { 18 | id?: string | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/resources/datasets/types/DatasetsGetResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | import { Dataset } from "../../../types/Dataset"; 9 | 10 | export const DatasetsGetResponse: core.serialization.ObjectSchema< 11 | serializers.DatasetsGetResponse.Raw, 12 | Cohere.DatasetsGetResponse 13 | > = core.serialization.object({ 14 | dataset: Dataset, 15 | }); 16 | 17 | export declare namespace DatasetsGetResponse { 18 | interface Raw { 19 | dataset: Dataset.Raw; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/serialization/resources/datasets/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./DatasetsListResponse"; 2 | export * from "./DatasetsCreateResponseDatasetPartsItem"; 3 | export * from "./DatasetsCreateResponse"; 4 | export * from "./DatasetsGetUsageResponse"; 5 | export * from "./DatasetsGetResponse"; 6 | -------------------------------------------------------------------------------- /src/serialization/resources/embedJobs/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/embedJobs/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { CreateEmbedJobRequest } from "./CreateEmbedJobRequest"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/embedJobs/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | export * from "./client"; 3 | -------------------------------------------------------------------------------- /src/serialization/resources/embedJobs/types/CreateEmbedJobRequestTruncate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | 9 | export const CreateEmbedJobRequestTruncate: core.serialization.Schema< 10 | serializers.CreateEmbedJobRequestTruncate.Raw, 11 | Cohere.CreateEmbedJobRequestTruncate 12 | > = core.serialization.enum_(["START", "END"]); 13 | 14 | export declare namespace CreateEmbedJobRequestTruncate { 15 | type Raw = "START" | "END"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/resources/embedJobs/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./CreateEmbedJobRequestTruncate"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/finetuning/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/finetuning/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { FinetuningUpdateFinetunedModelRequest } from "./FinetuningUpdateFinetunedModelRequest"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/finetuning/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./resources"; 2 | export * from "./client"; 3 | -------------------------------------------------------------------------------- /src/serialization/resources/finetuning/resources/finetuning/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/finetuning/resources/finetuning/types/Strategy.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../../../index"; 6 | import * as Cohere from "../../../../../../api/index"; 7 | import * as core from "../../../../../../core"; 8 | 9 | export const Strategy: core.serialization.Schema = 10 | core.serialization.enum_(["STRATEGY_UNSPECIFIED", "STRATEGY_VANILLA", "STRATEGY_TFEW"]); 11 | 12 | export declare namespace Strategy { 13 | type Raw = "STRATEGY_UNSPECIFIED" | "STRATEGY_VANILLA" | "STRATEGY_TFEW"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/resources/finetuning/resources/index.ts: -------------------------------------------------------------------------------- 1 | export * as finetuning from "./finetuning"; 2 | export * from "./finetuning/types"; 3 | -------------------------------------------------------------------------------- /src/serialization/resources/index.ts: -------------------------------------------------------------------------------- 1 | export * as v2 from "./v2"; 2 | export * from "./v2/types"; 3 | export * as embedJobs from "./embedJobs"; 4 | export * from "./embedJobs/types"; 5 | export * as datasets from "./datasets"; 6 | export * from "./datasets/types"; 7 | export * as finetuning from "./finetuning"; 8 | export * from "./v2/client/requests"; 9 | export * from "./embedJobs/client/requests"; 10 | export * as connectors from "./connectors"; 11 | export * from "./connectors/client/requests"; 12 | export * from "./finetuning/client/requests"; 13 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./requests"; 2 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/client/requests/index.ts: -------------------------------------------------------------------------------- 1 | export { V2ChatStreamRequest } from "./V2ChatStreamRequest"; 2 | export { V2ChatRequest } from "./V2ChatRequest"; 3 | export { V2EmbedRequest } from "./V2EmbedRequest"; 4 | export { V2RerankRequest } from "./V2RerankRequest"; 5 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./types"; 2 | export * from "./client"; 3 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/types/V2ChatRequestDocumentsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | import { Document } from "../../../types/Document"; 9 | 10 | export const V2ChatRequestDocumentsItem: core.serialization.Schema< 11 | serializers.V2ChatRequestDocumentsItem.Raw, 12 | Cohere.V2ChatRequestDocumentsItem 13 | > = core.serialization.undiscriminatedUnion([core.serialization.string(), Document]); 14 | 15 | export declare namespace V2ChatRequestDocumentsItem { 16 | type Raw = string | Document.Raw; 17 | } 18 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/types/V2ChatRequestSafetyMode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | 9 | export const V2ChatRequestSafetyMode: core.serialization.Schema< 10 | serializers.V2ChatRequestSafetyMode.Raw, 11 | Cohere.V2ChatRequestSafetyMode 12 | > = core.serialization.enum_(["CONTEXTUAL", "STRICT", "OFF"]); 13 | 14 | export declare namespace V2ChatRequestSafetyMode { 15 | type Raw = "CONTEXTUAL" | "STRICT" | "OFF"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/types/V2ChatRequestToolChoice.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | 9 | export const V2ChatRequestToolChoice: core.serialization.Schema< 10 | serializers.V2ChatRequestToolChoice.Raw, 11 | Cohere.V2ChatRequestToolChoice 12 | > = core.serialization.enum_(["REQUIRED", "NONE"]); 13 | 14 | export declare namespace V2ChatRequestToolChoice { 15 | type Raw = "REQUIRED" | "NONE"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/types/V2ChatStreamRequestSafetyMode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | 9 | export const V2ChatStreamRequestSafetyMode: core.serialization.Schema< 10 | serializers.V2ChatStreamRequestSafetyMode.Raw, 11 | Cohere.V2ChatStreamRequestSafetyMode 12 | > = core.serialization.enum_(["CONTEXTUAL", "STRICT", "OFF"]); 13 | 14 | export declare namespace V2ChatStreamRequestSafetyMode { 15 | type Raw = "CONTEXTUAL" | "STRICT" | "OFF"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/types/V2ChatStreamRequestToolChoice.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | 9 | export const V2ChatStreamRequestToolChoice: core.serialization.Schema< 10 | serializers.V2ChatStreamRequestToolChoice.Raw, 11 | Cohere.V2ChatStreamRequestToolChoice 12 | > = core.serialization.enum_(["REQUIRED", "NONE"]); 13 | 14 | export declare namespace V2ChatStreamRequestToolChoice { 15 | type Raw = "REQUIRED" | "NONE"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/types/V2EmbedRequestTruncate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | 9 | export const V2EmbedRequestTruncate: core.serialization.Schema< 10 | serializers.V2EmbedRequestTruncate.Raw, 11 | Cohere.V2EmbedRequestTruncate 12 | > = core.serialization.enum_(["NONE", "START", "END"]); 13 | 14 | export declare namespace V2EmbedRequestTruncate { 15 | type Raw = "NONE" | "START" | "END"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/types/V2RerankResponseResultsItemDocument.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../../../index"; 6 | import * as Cohere from "../../../../api/index"; 7 | import * as core from "../../../../core"; 8 | 9 | export const V2RerankResponseResultsItemDocument: core.serialization.ObjectSchema< 10 | serializers.V2RerankResponseResultsItemDocument.Raw, 11 | Cohere.V2RerankResponseResultsItemDocument 12 | > = core.serialization.object({ 13 | text: core.serialization.string(), 14 | }); 15 | 16 | export declare namespace V2RerankResponseResultsItemDocument { 17 | interface Raw { 18 | text: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/resources/v2/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./V2ChatStreamRequestDocumentsItem"; 2 | export * from "./V2ChatStreamRequestSafetyMode"; 3 | export * from "./V2ChatStreamRequestToolChoice"; 4 | export * from "./V2ChatRequestDocumentsItem"; 5 | export * from "./V2ChatRequestSafetyMode"; 6 | export * from "./V2ChatRequestToolChoice"; 7 | export * from "./V2EmbedRequestTruncate"; 8 | export * from "./V2RerankResponseResultsItemDocument"; 9 | export * from "./V2RerankResponseResultsItem"; 10 | export * from "./V2RerankResponse"; 11 | -------------------------------------------------------------------------------- /src/serialization/types/AuthTokenType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const AuthTokenType: core.serialization.Schema = 10 | core.serialization.enum_(["bearer", "basic", "noscheme"]); 11 | 12 | export declare namespace AuthTokenType { 13 | type Raw = "bearer" | "basic" | "noscheme"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/ChatCitationType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatCitationType: core.serialization.Schema = 10 | core.serialization.enum_(["TEXT_CONTENT", "PLAN"]); 11 | 12 | export declare namespace ChatCitationType { 13 | type Raw = "TEXT_CONTENT" | "PLAN"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/ChatDocument.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatDocument: core.serialization.Schema = 10 | core.serialization.record(core.serialization.string(), core.serialization.string()); 11 | 12 | export declare namespace ChatDocument { 13 | type Raw = Record; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/ChatFinishReason.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatFinishReason: core.serialization.Schema = 10 | core.serialization.enum_(["COMPLETE", "STOP_SEQUENCE", "MAX_TOKENS", "TOOL_CALL", "ERROR"]); 11 | 12 | export declare namespace ChatFinishReason { 13 | type Raw = "COMPLETE" | "STOP_SEQUENCE" | "MAX_TOKENS" | "TOOL_CALL" | "ERROR"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/ChatMessageStartEventDeltaMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatMessageStartEventDeltaMessage: core.serialization.ObjectSchema< 10 | serializers.ChatMessageStartEventDeltaMessage.Raw, 11 | Cohere.ChatMessageStartEventDeltaMessage 12 | > = core.serialization.object({ 13 | role: core.serialization.stringLiteral("assistant").optional(), 14 | }); 15 | 16 | export declare namespace ChatMessageStartEventDeltaMessage { 17 | interface Raw { 18 | role?: "assistant" | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ChatMessages.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { ChatMessageV2 } from "./ChatMessageV2"; 9 | 10 | export const ChatMessages: core.serialization.Schema = 11 | core.serialization.list(ChatMessageV2); 12 | 13 | export declare namespace ChatMessages { 14 | type Raw = ChatMessageV2.Raw[]; 15 | } 16 | -------------------------------------------------------------------------------- /src/serialization/types/ChatRequestCitationQuality.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatRequestCitationQuality: core.serialization.Schema< 10 | serializers.ChatRequestCitationQuality.Raw, 11 | Cohere.ChatRequestCitationQuality 12 | > = core.serialization.enum_(["fast", "accurate", "off"]); 13 | 14 | export declare namespace ChatRequestCitationQuality { 15 | type Raw = "fast" | "accurate" | "off"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ChatRequestConnectorsSearchOptions.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatRequestConnectorsSearchOptions: core.serialization.ObjectSchema< 10 | serializers.ChatRequestConnectorsSearchOptions.Raw, 11 | Cohere.ChatRequestConnectorsSearchOptions 12 | > = core.serialization.object({ 13 | seed: core.serialization.number().optional(), 14 | }); 15 | 16 | export declare namespace ChatRequestConnectorsSearchOptions { 17 | interface Raw { 18 | seed?: number | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ChatRequestPromptTruncation.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatRequestPromptTruncation: core.serialization.Schema< 10 | serializers.ChatRequestPromptTruncation.Raw, 11 | Cohere.ChatRequestPromptTruncation 12 | > = core.serialization.enum_(["OFF", "AUTO", "AUTO_PRESERVE_ORDER"]); 13 | 14 | export declare namespace ChatRequestPromptTruncation { 15 | type Raw = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ChatRequestSafetyMode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatRequestSafetyMode: core.serialization.Schema< 10 | serializers.ChatRequestSafetyMode.Raw, 11 | Cohere.ChatRequestSafetyMode 12 | > = core.serialization.enum_(["CONTEXTUAL", "STRICT", "NONE"]); 13 | 14 | export declare namespace ChatRequestSafetyMode { 15 | type Raw = "CONTEXTUAL" | "STRICT" | "NONE"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ChatSearchQuery.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatSearchQuery: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | text: core.serialization.string(), 12 | generationId: core.serialization.property("generation_id", core.serialization.string()), 13 | }); 14 | 15 | export declare namespace ChatSearchQuery { 16 | interface Raw { 17 | text: string; 18 | generation_id: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ChatSearchResultConnector.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatSearchResultConnector: core.serialization.ObjectSchema< 10 | serializers.ChatSearchResultConnector.Raw, 11 | Cohere.ChatSearchResultConnector 12 | > = core.serialization.object({ 13 | id: core.serialization.string(), 14 | }); 15 | 16 | export declare namespace ChatSearchResultConnector { 17 | interface Raw { 18 | id: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ChatStreamEndEventFinishReason.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatStreamEndEventFinishReason: core.serialization.Schema< 10 | serializers.ChatStreamEndEventFinishReason.Raw, 11 | Cohere.ChatStreamEndEventFinishReason 12 | > = core.serialization.enum_(["COMPLETE", "ERROR_LIMIT", "MAX_TOKENS", "ERROR", "ERROR_TOXIC"]); 13 | 14 | export declare namespace ChatStreamEndEventFinishReason { 15 | type Raw = "COMPLETE" | "ERROR_LIMIT" | "MAX_TOKENS" | "ERROR" | "ERROR_TOXIC"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ChatStreamEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatStreamEvent: core.serialization.ObjectSchema = 10 | core.serialization.object({}); 11 | 12 | export declare namespace ChatStreamEvent { 13 | interface Raw {} 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/ChatStreamEventType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatStreamEventType: core.serialization.ObjectSchema< 10 | serializers.ChatStreamEventType.Raw, 11 | Cohere.ChatStreamEventType 12 | > = core.serialization.object({}); 13 | 14 | export declare namespace ChatStreamEventType { 15 | interface Raw {} 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ChatStreamRequestCitationQuality.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatStreamRequestCitationQuality: core.serialization.Schema< 10 | serializers.ChatStreamRequestCitationQuality.Raw, 11 | Cohere.ChatStreamRequestCitationQuality 12 | > = core.serialization.enum_(["fast", "accurate", "off"]); 13 | 14 | export declare namespace ChatStreamRequestCitationQuality { 15 | type Raw = "fast" | "accurate" | "off"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ChatStreamRequestPromptTruncation.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatStreamRequestPromptTruncation: core.serialization.Schema< 10 | serializers.ChatStreamRequestPromptTruncation.Raw, 11 | Cohere.ChatStreamRequestPromptTruncation 12 | > = core.serialization.enum_(["OFF", "AUTO", "AUTO_PRESERVE_ORDER"]); 13 | 14 | export declare namespace ChatStreamRequestPromptTruncation { 15 | type Raw = "OFF" | "AUTO" | "AUTO_PRESERVE_ORDER"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ChatStreamRequestSafetyMode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ChatStreamRequestSafetyMode: core.serialization.Schema< 10 | serializers.ChatStreamRequestSafetyMode.Raw, 11 | Cohere.ChatStreamRequestSafetyMode 12 | > = core.serialization.enum_(["CONTEXTUAL", "STRICT", "NONE"]); 13 | 14 | export declare namespace ChatStreamRequestSafetyMode { 15 | type Raw = "CONTEXTUAL" | "STRICT" | "NONE"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/CitationOptions.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { CitationOptionsMode } from "./CitationOptionsMode"; 9 | 10 | export const CitationOptions: core.serialization.ObjectSchema = 11 | core.serialization.object({ 12 | mode: CitationOptionsMode.optional(), 13 | }); 14 | 15 | export declare namespace CitationOptions { 16 | interface Raw { 17 | mode?: CitationOptionsMode.Raw | null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/serialization/types/CitationOptionsMode.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const CitationOptionsMode: core.serialization.Schema< 10 | serializers.CitationOptionsMode.Raw, 11 | Cohere.CitationOptionsMode 12 | > = core.serialization.enum_(["FAST", "ACCURATE", "OFF"]); 13 | 14 | export declare namespace CitationOptionsMode { 15 | type Raw = "FAST" | "ACCURATE" | "OFF"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/CitationType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const CitationType: core.serialization.Schema = 10 | core.serialization.enum_(["TEXT_CONTENT", "PLAN"]); 11 | 12 | export declare namespace CitationType { 13 | type Raw = "TEXT_CONTENT" | "PLAN"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/ClassifyExample.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ClassifyExample: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | text: core.serialization.string().optional(), 12 | label: core.serialization.string().optional(), 13 | }); 14 | 15 | export declare namespace ClassifyExample { 16 | interface Raw { 17 | text?: string | null; 18 | label?: string | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ClassifyRequestTruncate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ClassifyRequestTruncate: core.serialization.Schema< 10 | serializers.ClassifyRequestTruncate.Raw, 11 | Cohere.ClassifyRequestTruncate 12 | > = core.serialization.enum_(["NONE", "START", "END"]); 13 | 14 | export declare namespace ClassifyRequestTruncate { 15 | type Raw = "NONE" | "START" | "END"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/CompatibleEndpoint.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const CompatibleEndpoint: core.serialization.Schema< 10 | serializers.CompatibleEndpoint.Raw, 11 | Cohere.CompatibleEndpoint 12 | > = core.serialization.enum_(["chat", "embed", "classify", "summarize", "rerank", "rate", "generate"]); 13 | 14 | export declare namespace CompatibleEndpoint { 15 | type Raw = "chat" | "embed" | "classify" | "summarize" | "rerank" | "rate" | "generate"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ConnectorAuthStatus.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ConnectorAuthStatus: core.serialization.Schema< 10 | serializers.ConnectorAuthStatus.Raw, 11 | Cohere.ConnectorAuthStatus 12 | > = core.serialization.enum_(["valid", "expired"]); 13 | 14 | export declare namespace ConnectorAuthStatus { 15 | type Raw = "valid" | "expired"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/CreateConnectorResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { Connector } from "./Connector"; 9 | 10 | export const CreateConnectorResponse: core.serialization.ObjectSchema< 11 | serializers.CreateConnectorResponse.Raw, 12 | Cohere.CreateConnectorResponse 13 | > = core.serialization.object({ 14 | connector: Connector, 15 | }); 16 | 17 | export declare namespace CreateConnectorResponse { 18 | interface Raw { 19 | connector: Connector.Raw; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/serialization/types/DatasetValidationStatus.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const DatasetValidationStatus: core.serialization.Schema< 10 | serializers.DatasetValidationStatus.Raw, 11 | Cohere.DatasetValidationStatus 12 | > = core.serialization.enum_(["unknown", "queued", "processing", "failed", "validated", "skipped"]); 13 | 14 | export declare namespace DatasetValidationStatus { 15 | type Raw = "unknown" | "queued" | "processing" | "failed" | "validated" | "skipped"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/DeleteConnectorResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const DeleteConnectorResponse: core.serialization.Schema< 10 | serializers.DeleteConnectorResponse.Raw, 11 | Cohere.DeleteConnectorResponse 12 | > = core.serialization.record(core.serialization.string(), core.serialization.unknown()); 13 | 14 | export declare namespace DeleteConnectorResponse { 15 | type Raw = Record; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/DetokenizeResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { ApiMeta } from "./ApiMeta"; 9 | 10 | export const DetokenizeResponse: core.serialization.ObjectSchema< 11 | serializers.DetokenizeResponse.Raw, 12 | Cohere.DetokenizeResponse 13 | > = core.serialization.object({ 14 | text: core.serialization.string(), 15 | meta: ApiMeta.optional(), 16 | }); 17 | 18 | export declare namespace DetokenizeResponse { 19 | interface Raw { 20 | text: string; 21 | meta?: ApiMeta.Raw | null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/serialization/types/Document.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const Document: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | data: core.serialization.record(core.serialization.string(), core.serialization.unknown()), 12 | id: core.serialization.string().optional(), 13 | }); 14 | 15 | export declare namespace Document { 16 | interface Raw { 17 | data: Record; 18 | id?: string | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/DocumentContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { Document } from "./Document"; 9 | 10 | export const DocumentContent: core.serialization.ObjectSchema = 11 | core.serialization.object({ 12 | document: Document, 13 | }); 14 | 15 | export declare namespace DocumentContent { 16 | interface Raw { 17 | document: Document.Raw; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/serialization/types/EmbedImage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { EmbedImageUrl } from "./EmbedImageUrl"; 9 | 10 | export const EmbedImage: core.serialization.ObjectSchema = 11 | core.serialization.object({ 12 | imageUrl: core.serialization.property("image_url", EmbedImageUrl.optional()), 13 | }); 14 | 15 | export declare namespace EmbedImage { 16 | interface Raw { 17 | image_url?: EmbedImageUrl.Raw | null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/serialization/types/EmbedImageUrl.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const EmbedImageUrl: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | url: core.serialization.string(), 12 | }); 13 | 14 | export declare namespace EmbedImageUrl { 15 | interface Raw { 16 | url: string; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/serialization/types/EmbedInput.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { EmbedContent } from "./EmbedContent"; 9 | 10 | export const EmbedInput: core.serialization.ObjectSchema = 11 | core.serialization.object({ 12 | content: core.serialization.list(EmbedContent), 13 | }); 14 | 15 | export declare namespace EmbedInput { 16 | interface Raw { 17 | content: EmbedContent.Raw[]; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/serialization/types/EmbedInputType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const EmbedInputType: core.serialization.Schema = 10 | core.serialization.enum_(["search_document", "search_query", "classification", "clustering", "image"]); 11 | 12 | export declare namespace EmbedInputType { 13 | type Raw = "search_document" | "search_query" | "classification" | "clustering" | "image"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/EmbedJobStatus.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const EmbedJobStatus: core.serialization.Schema = 10 | core.serialization.enum_(["processing", "complete", "cancelling", "cancelled", "failed"]); 11 | 12 | export declare namespace EmbedJobStatus { 13 | type Raw = "processing" | "complete" | "cancelling" | "cancelled" | "failed"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/EmbedJobTruncate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const EmbedJobTruncate: core.serialization.Schema = 10 | core.serialization.enum_(["START", "END"]); 11 | 12 | export declare namespace EmbedJobTruncate { 13 | type Raw = "START" | "END"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/EmbedRequestTruncate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const EmbedRequestTruncate: core.serialization.Schema< 10 | serializers.EmbedRequestTruncate.Raw, 11 | Cohere.EmbedRequestTruncate 12 | > = core.serialization.enum_(["NONE", "START", "END"]); 13 | 14 | export declare namespace EmbedRequestTruncate { 15 | type Raw = "NONE" | "START" | "END"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/EmbedText.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const EmbedText: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | text: core.serialization.string().optional(), 12 | }); 13 | 14 | export declare namespace EmbedText { 15 | interface Raw { 16 | text?: string | null; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/serialization/types/EmbeddingType.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const EmbeddingType: core.serialization.Schema = 10 | core.serialization.enum_(["float", "int8", "uint8", "binary", "ubinary"]); 11 | 12 | export declare namespace EmbeddingType { 13 | type Raw = "float" | "int8" | "uint8" | "binary" | "ubinary"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/GenerateRequestReturnLikelihoods.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const GenerateRequestReturnLikelihoods: core.serialization.Schema< 10 | serializers.GenerateRequestReturnLikelihoods.Raw, 11 | Cohere.GenerateRequestReturnLikelihoods 12 | > = core.serialization.enum_(["GENERATION", "ALL", "NONE"]); 13 | 14 | export declare namespace GenerateRequestReturnLikelihoods { 15 | type Raw = "GENERATION" | "ALL" | "NONE"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/GenerateRequestTruncate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const GenerateRequestTruncate: core.serialization.Schema< 10 | serializers.GenerateRequestTruncate.Raw, 11 | Cohere.GenerateRequestTruncate 12 | > = core.serialization.enum_(["NONE", "START", "END"]); 13 | 14 | export declare namespace GenerateRequestTruncate { 15 | type Raw = "NONE" | "START" | "END"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/GenerateStreamEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const GenerateStreamEvent: core.serialization.ObjectSchema< 10 | serializers.GenerateStreamEvent.Raw, 11 | Cohere.GenerateStreamEvent 12 | > = core.serialization.object({}); 13 | 14 | export declare namespace GenerateStreamEvent { 15 | interface Raw {} 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/GenerateStreamRequestReturnLikelihoods.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const GenerateStreamRequestReturnLikelihoods: core.serialization.Schema< 10 | serializers.GenerateStreamRequestReturnLikelihoods.Raw, 11 | Cohere.GenerateStreamRequestReturnLikelihoods 12 | > = core.serialization.enum_(["GENERATION", "ALL", "NONE"]); 13 | 14 | export declare namespace GenerateStreamRequestReturnLikelihoods { 15 | type Raw = "GENERATION" | "ALL" | "NONE"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/GenerateStreamRequestTruncate.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const GenerateStreamRequestTruncate: core.serialization.Schema< 10 | serializers.GenerateStreamRequestTruncate.Raw, 11 | Cohere.GenerateStreamRequestTruncate 12 | > = core.serialization.enum_(["NONE", "START", "END"]); 13 | 14 | export declare namespace GenerateStreamRequestTruncate { 15 | type Raw = "NONE" | "START" | "END"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/GetConnectorResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { Connector } from "./Connector"; 9 | 10 | export const GetConnectorResponse: core.serialization.ObjectSchema< 11 | serializers.GetConnectorResponse.Raw, 12 | Cohere.GetConnectorResponse 13 | > = core.serialization.object({ 14 | connector: Connector, 15 | }); 16 | 17 | export declare namespace GetConnectorResponse { 18 | interface Raw { 19 | connector: Connector.Raw; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/serialization/types/ImageContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { ImageUrl } from "./ImageUrl"; 9 | 10 | export const ImageContent: core.serialization.ObjectSchema = 11 | core.serialization.object({ 12 | imageUrl: core.serialization.property("image_url", ImageUrl), 13 | }); 14 | 15 | export declare namespace ImageContent { 16 | interface Raw { 17 | image_url: ImageUrl.Raw; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/serialization/types/ImageUrl.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ImageUrl: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | url: core.serialization.string(), 12 | }); 13 | 14 | export declare namespace ImageUrl { 15 | interface Raw { 16 | url: string; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/serialization/types/JsonResponseFormat.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const JsonResponseFormat: core.serialization.ObjectSchema< 10 | serializers.JsonResponseFormat.Raw, 11 | Cohere.JsonResponseFormat 12 | > = core.serialization.object({ 13 | schema: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), 14 | }); 15 | 16 | export declare namespace JsonResponseFormat { 17 | interface Raw { 18 | schema?: Record | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/OAuthAuthorizeResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const OAuthAuthorizeResponse: core.serialization.ObjectSchema< 10 | serializers.OAuthAuthorizeResponse.Raw, 11 | Cohere.OAuthAuthorizeResponse 12 | > = core.serialization.object({ 13 | redirectUrl: core.serialization.property("redirect_url", core.serialization.string().optional()), 14 | }); 15 | 16 | export declare namespace OAuthAuthorizeResponse { 17 | interface Raw { 18 | redirect_url?: string | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ParseInfo.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ParseInfo: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | separator: core.serialization.string().optional(), 12 | delimiter: core.serialization.string().optional(), 13 | }); 14 | 15 | export declare namespace ParseInfo { 16 | interface Raw { 17 | separator?: string | null; 18 | delimiter?: string | null; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ReasoningEffort.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ReasoningEffort: core.serialization.Schema = 10 | core.serialization.enum_(["low", "medium", "high"]); 11 | 12 | export declare namespace ReasoningEffort { 13 | type Raw = "low" | "medium" | "high"; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/RerankDocument.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const RerankDocument: core.serialization.Schema = 10 | core.serialization.record(core.serialization.string(), core.serialization.string()); 11 | 12 | export declare namespace RerankDocument { 13 | type Raw = Record; 14 | } 15 | -------------------------------------------------------------------------------- /src/serialization/types/RerankRequestDocumentsItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { RerankDocument } from "./RerankDocument"; 9 | 10 | export const RerankRequestDocumentsItem: core.serialization.Schema< 11 | serializers.RerankRequestDocumentsItem.Raw, 12 | Cohere.RerankRequestDocumentsItem 13 | > = core.serialization.undiscriminatedUnion([core.serialization.string(), RerankDocument]); 14 | 15 | export declare namespace RerankRequestDocumentsItem { 16 | type Raw = string | RerankDocument.Raw; 17 | } 18 | -------------------------------------------------------------------------------- /src/serialization/types/RerankResponseResultsItemDocument.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const RerankResponseResultsItemDocument: core.serialization.ObjectSchema< 10 | serializers.RerankResponseResultsItemDocument.Raw, 11 | Cohere.RerankResponseResultsItemDocument 12 | > = core.serialization.object({ 13 | text: core.serialization.string(), 14 | }); 15 | 16 | export declare namespace RerankResponseResultsItemDocument { 17 | interface Raw { 18 | text: string; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/SummarizeRequestExtractiveness.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const SummarizeRequestExtractiveness: core.serialization.Schema< 10 | serializers.SummarizeRequestExtractiveness.Raw, 11 | Cohere.SummarizeRequestExtractiveness 12 | > = core.serialization.enum_(["low", "medium", "high"]); 13 | 14 | export declare namespace SummarizeRequestExtractiveness { 15 | type Raw = "low" | "medium" | "high"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/SummarizeRequestFormat.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const SummarizeRequestFormat: core.serialization.Schema< 10 | serializers.SummarizeRequestFormat.Raw, 11 | Cohere.SummarizeRequestFormat 12 | > = core.serialization.enum_(["paragraph", "bullets"]); 13 | 14 | export declare namespace SummarizeRequestFormat { 15 | type Raw = "paragraph" | "bullets"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/SummarizeRequestLength.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const SummarizeRequestLength: core.serialization.Schema< 10 | serializers.SummarizeRequestLength.Raw, 11 | Cohere.SummarizeRequestLength 12 | > = core.serialization.enum_(["short", "medium", "long"]); 13 | 14 | export declare namespace SummarizeRequestLength { 15 | type Raw = "short" | "medium" | "long"; 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/SystemMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { SystemMessageContent } from "./SystemMessageContent"; 9 | 10 | export const SystemMessage: core.serialization.ObjectSchema = 11 | core.serialization.object({ 12 | content: SystemMessageContent, 13 | }); 14 | 15 | export declare namespace SystemMessage { 16 | interface Raw { 17 | content: SystemMessageContent.Raw; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/serialization/types/TextContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const TextContent: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | text: core.serialization.string(), 12 | }); 13 | 14 | export declare namespace TextContent { 15 | interface Raw { 16 | text: string; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/serialization/types/TextResponseFormat.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const TextResponseFormat: core.serialization.ObjectSchema< 10 | serializers.TextResponseFormat.Raw, 11 | Cohere.TextResponseFormat 12 | > = core.serialization.object({}); 13 | 14 | export declare namespace TextResponseFormat { 15 | interface Raw {} 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/TextResponseFormatV2.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const TextResponseFormatV2: core.serialization.ObjectSchema< 10 | serializers.TextResponseFormatV2.Raw, 11 | Cohere.TextResponseFormatV2 12 | > = core.serialization.object({}); 13 | 14 | export declare namespace TextResponseFormatV2 { 15 | interface Raw {} 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/ToolCall.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ToolCall: core.serialization.ObjectSchema = 10 | core.serialization.object({ 11 | name: core.serialization.string(), 12 | parameters: core.serialization.record(core.serialization.string(), core.serialization.unknown()), 13 | }); 14 | 15 | export declare namespace ToolCall { 16 | interface Raw { 17 | name: string; 18 | parameters: Record; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/serialization/types/ToolCallV2Function.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const ToolCallV2Function: core.serialization.ObjectSchema< 10 | serializers.ToolCallV2Function.Raw, 11 | Cohere.ToolCallV2Function 12 | > = core.serialization.object({ 13 | name: core.serialization.string().optional(), 14 | arguments: core.serialization.string().optional(), 15 | }); 16 | 17 | export declare namespace ToolCallV2Function { 18 | interface Raw { 19 | name?: string | null; 20 | arguments?: string | null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/serialization/types/ToolMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { ToolResult } from "./ToolResult"; 9 | 10 | export const ToolMessage: core.serialization.ObjectSchema = 11 | core.serialization.object({ 12 | toolResults: core.serialization.property("tool_results", core.serialization.list(ToolResult).optional()), 13 | }); 14 | 15 | export declare namespace ToolMessage { 16 | interface Raw { 17 | tool_results?: ToolResult.Raw[] | null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/serialization/types/ToolMessageV2Content.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { ToolContent } from "./ToolContent"; 9 | 10 | export const ToolMessageV2Content: core.serialization.Schema< 11 | serializers.ToolMessageV2Content.Raw, 12 | Cohere.ToolMessageV2Content 13 | > = core.serialization.undiscriminatedUnion([core.serialization.string(), core.serialization.list(ToolContent)]); 14 | 15 | export declare namespace ToolMessageV2Content { 16 | type Raw = string | ToolContent.Raw[]; 17 | } 18 | -------------------------------------------------------------------------------- /src/serialization/types/TruncationStrategyAutoPreserveOrder.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const TruncationStrategyAutoPreserveOrder: core.serialization.ObjectSchema< 10 | serializers.TruncationStrategyAutoPreserveOrder.Raw, 11 | Cohere.TruncationStrategyAutoPreserveOrder 12 | > = core.serialization.object({}); 13 | 14 | export declare namespace TruncationStrategyAutoPreserveOrder { 15 | interface Raw {} 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/TruncationStrategyNone.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | 9 | export const TruncationStrategyNone: core.serialization.ObjectSchema< 10 | serializers.TruncationStrategyNone.Raw, 11 | Cohere.TruncationStrategyNone 12 | > = core.serialization.object({}); 13 | 14 | export declare namespace TruncationStrategyNone { 15 | interface Raw {} 16 | } 17 | -------------------------------------------------------------------------------- /src/serialization/types/UpdateConnectorResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { Connector } from "./Connector"; 9 | 10 | export const UpdateConnectorResponse: core.serialization.ObjectSchema< 11 | serializers.UpdateConnectorResponse.Raw, 12 | Cohere.UpdateConnectorResponse 13 | > = core.serialization.object({ 14 | connector: Connector, 15 | }); 16 | 17 | export declare namespace UpdateConnectorResponse { 18 | interface Raw { 19 | connector: Connector.Raw; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/serialization/types/UserMessage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { UserMessageContent } from "./UserMessageContent"; 9 | 10 | export const UserMessage: core.serialization.ObjectSchema = 11 | core.serialization.object({ 12 | content: UserMessageContent, 13 | }); 14 | 15 | export declare namespace UserMessage { 16 | interface Raw { 17 | content: UserMessageContent.Raw; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/serialization/types/UserMessageContent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file was auto-generated by Fern from our API Definition. 3 | */ 4 | 5 | import * as serializers from "../index"; 6 | import * as Cohere from "../../api/index"; 7 | import * as core from "../../core"; 8 | import { Content } from "./Content"; 9 | 10 | export const UserMessageContent: core.serialization.Schema< 11 | serializers.UserMessageContent.Raw, 12 | Cohere.UserMessageContent 13 | > = core.serialization.undiscriminatedUnion([core.serialization.string(), core.serialization.list(Content)]); 14 | 15 | export declare namespace UserMessageContent { 16 | type Raw = string | Content.Raw[]; 17 | } 18 | -------------------------------------------------------------------------------- /src/test/__snapshots__/aws-util-tests.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`test aws utils parseAWSEvent 1`] = `undefined`; 4 | 5 | exports[`test aws utils parseAWSEvent 2`] = `undefined`; 6 | 7 | exports[`test aws utils parseAWSEvent 3`] = ` 8 | { 9 | "event_type": "text-generation", 10 | "is_finished": false, 11 | "text": "Hello", 12 | } 13 | `; 14 | 15 | exports[`test aws utils parseAWSEvent 4`] = ` 16 | { 17 | "event_type": "text-generation", 18 | "is_finished": false, 19 | "text": "!", 20 | } 21 | `; 22 | -------------------------------------------------------------------------------- /src/test/__snapshots__/client.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`v1 back compat https://api.cohere.com/ 1`] = `"https://api.cohere.com/v1/chat"`; 4 | 5 | exports[`v1 back compat https://api.cohere.com/v1 1`] = `"https://api.cohere.com/v1/chat"`; 6 | 7 | exports[`v1 back compat https://api.cohere.com/v1/ 1`] = `"https://api.cohere.com/v1/chat"`; 8 | 9 | exports[`v1 back compat https://api.cohere.com/v1// 1`] = `"https://api.cohere.com/v1/v1/chat"`; 10 | 11 | exports[`v1 back compat https://api.cohere.com/v2 1`] = `"https://api.cohere.com/v2/v1/chat"`; 12 | -------------------------------------------------------------------------------- /src/version.ts: -------------------------------------------------------------------------------- 1 | export const SDK_VERSION = "7.17.1"; 2 | -------------------------------------------------------------------------------- /tests/custom.test.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a custom test file, if you wish to add more tests 3 | * to your SDK. 4 | * Be sure to mark this file in `.fernignore`. 5 | * 6 | * If you include example requests/responses in your fern definition, 7 | * you will have tests automatically generated for you. 8 | */ 9 | describe("test", () => { 10 | it("default", () => { 11 | expect(true).toBe(true); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /tests/unit/auth/BearerToken.test.ts: -------------------------------------------------------------------------------- 1 | import { BearerToken } from "../../../src/core/auth/BearerToken"; 2 | 3 | describe("BearerToken", () => { 4 | describe("toAuthorizationHeader", () => { 5 | it("correctly converts to header", () => { 6 | expect(BearerToken.toAuthorizationHeader("my-token")).toBe("Bearer my-token"); 7 | }); 8 | }); 9 | describe("fromAuthorizationHeader", () => { 10 | it("correctly parses header", () => { 11 | expect(BearerToken.fromAuthorizationHeader("Bearer my-token")).toBe("my-token"); 12 | }); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/unit/fetcher/test-file.txt: -------------------------------------------------------------------------------- 1 | This is a test file! 2 | -------------------------------------------------------------------------------- /tests/unit/zurg/lazy/lazyObject.test.ts: -------------------------------------------------------------------------------- 1 | import { lazyObject, number, object, string } from "../../../../src/core/schemas/builders"; 2 | import { itSchemaIdentity } from "../utils/itSchema"; 3 | 4 | describe("lazy", () => { 5 | itSchemaIdentity( 6 | lazyObject(() => object({ foo: string() })), 7 | { foo: "hello" } 8 | ); 9 | 10 | itSchemaIdentity( 11 | lazyObject(() => object({ foo: string() })).extend(object({ bar: number() })), 12 | { 13 | foo: "hello", 14 | bar: 42, 15 | }, 16 | { title: "returned schema has object utils" } 17 | ); 18 | }); 19 | -------------------------------------------------------------------------------- /tests/unit/zurg/lazy/recursive/a.ts: -------------------------------------------------------------------------------- 1 | import { object } from "../../../../../src/core/schemas/builders/object"; 2 | import { schemaB } from "./b"; 3 | 4 | // @ts-expect-error 5 | export const schemaA = object({ 6 | b: schemaB, 7 | }); 8 | -------------------------------------------------------------------------------- /tests/unit/zurg/lazy/recursive/b.ts: -------------------------------------------------------------------------------- 1 | import { object } from "../../../../../src/core/schemas/builders/object"; 2 | import { optional } from "../../../../../src/core/schemas/builders/schema-utils"; 3 | import { schemaA } from "./a"; 4 | 5 | // @ts-expect-error 6 | export const schemaB = object({ 7 | a: optional(schemaA), 8 | }); 9 | -------------------------------------------------------------------------------- /tests/unit/zurg/literals/stringLiteral.test.ts: -------------------------------------------------------------------------------- 1 | import { stringLiteral } from "../../../../src/core/schemas/builders"; 2 | import { itSchemaIdentity } from "../utils/itSchema"; 3 | import { itValidate } from "../utils/itValidate"; 4 | 5 | describe("stringLiteral", () => { 6 | itSchemaIdentity(stringLiteral("A"), "A"); 7 | 8 | itValidate("incorrect string", stringLiteral("A"), "B", [ 9 | { 10 | path: [], 11 | message: 'Expected "A". Received "B".', 12 | }, 13 | ]); 14 | 15 | itValidate("non-string", stringLiteral("A"), 42, [ 16 | { 17 | path: [], 18 | message: 'Expected "A". Received 42.', 19 | }, 20 | ]); 21 | }); 22 | -------------------------------------------------------------------------------- /tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts: -------------------------------------------------------------------------------- 1 | import { objectWithoutOptionalProperties, string, stringLiteral } from "../../../../src/core/schemas/builders"; 2 | import { itSchema } from "../utils/itSchema"; 3 | 4 | describe("objectWithoutOptionalProperties", () => { 5 | itSchema( 6 | "all properties are required", 7 | objectWithoutOptionalProperties({ 8 | foo: string(), 9 | bar: stringLiteral("bar").optional(), 10 | }), 11 | { 12 | raw: { 13 | foo: "hello", 14 | }, 15 | // @ts-expect-error 16 | parsed: { 17 | foo: "hello", 18 | }, 19 | } 20 | ); 21 | }); 22 | -------------------------------------------------------------------------------- /tests/unit/zurg/primitives/any.test.ts: -------------------------------------------------------------------------------- 1 | import { any } from "../../../../src/core/schemas/builders"; 2 | import { itSchemaIdentity } from "../utils/itSchema"; 3 | 4 | describe("any", () => { 5 | itSchemaIdentity(any(), true); 6 | }); 7 | -------------------------------------------------------------------------------- /tests/unit/zurg/primitives/boolean.test.ts: -------------------------------------------------------------------------------- 1 | import { boolean } from "../../../../src/core/schemas/builders"; 2 | import { itSchemaIdentity } from "../utils/itSchema"; 3 | import { itValidate } from "../utils/itValidate"; 4 | 5 | describe("boolean", () => { 6 | itSchemaIdentity(boolean(), true); 7 | 8 | itValidate("non-boolean", boolean(), {}, [ 9 | { 10 | path: [], 11 | message: "Expected boolean. Received object.", 12 | }, 13 | ]); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/unit/zurg/primitives/number.test.ts: -------------------------------------------------------------------------------- 1 | import { number } from "../../../../src/core/schemas/builders"; 2 | import { itSchemaIdentity } from "../utils/itSchema"; 3 | import { itValidate } from "../utils/itValidate"; 4 | 5 | describe("number", () => { 6 | itSchemaIdentity(number(), 42); 7 | 8 | itValidate("non-number", number(), "hello", [ 9 | { 10 | path: [], 11 | message: 'Expected number. Received "hello".', 12 | }, 13 | ]); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/unit/zurg/primitives/string.test.ts: -------------------------------------------------------------------------------- 1 | import { string } from "../../../../src/core/schemas/builders"; 2 | import { itSchemaIdentity } from "../utils/itSchema"; 3 | import { itValidate } from "../utils/itValidate"; 4 | 5 | describe("string", () => { 6 | itSchemaIdentity(string(), "hello"); 7 | 8 | itValidate("non-string", string(), 42, [ 9 | { 10 | path: [], 11 | message: "Expected string. Received 42.", 12 | }, 13 | ]); 14 | }); 15 | -------------------------------------------------------------------------------- /tests/unit/zurg/primitives/unknown.test.ts: -------------------------------------------------------------------------------- 1 | import { unknown } from "../../../../src/core/schemas/builders"; 2 | import { itSchemaIdentity } from "../utils/itSchema"; 3 | 4 | describe("unknown", () => { 5 | itSchemaIdentity(unknown(), true); 6 | }); 7 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "extendedDiagnostics": true, 4 | "strict": true, 5 | "target": "ES6", 6 | "module": "CommonJS", 7 | "moduleResolution": "node", 8 | "esModuleInterop": true, 9 | "skipLibCheck": true, 10 | "declaration": true, 11 | "outDir": "dist", 12 | "rootDir": "src", 13 | "baseUrl": "src" 14 | }, 15 | "include": ["src"], 16 | "exclude": [] 17 | } 18 | --------------------------------------------------------------------------------