tekimax-ts 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +67 -3
- package/dist/index.d.ts +67 -3
- package/dist/index.js +83 -4
- package/dist/index.mjs +82 -4
- package/package.json +1 -1
- package/src/client.ts +100 -7
- package/src/index.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -31633,16 +31633,80 @@ declare const userMessageItemParamSchema: z.ZodObject<{
|
|
|
31633
31633
|
|
|
31634
31634
|
declare const verbosityEnumSchema: z.ZodEnum<["low", "medium", "high"]>;
|
|
31635
31635
|
|
|
31636
|
+
/**
|
|
31637
|
+
* A wrapper around the raw API response that provides helper methods
|
|
31638
|
+
* for common tasks like extracting text content.
|
|
31639
|
+
*/
|
|
31640
|
+
declare class TekimaxResponse {
|
|
31641
|
+
private readonly _raw;
|
|
31642
|
+
constructor(_raw: ResponseResource);
|
|
31643
|
+
/**
|
|
31644
|
+
* Access the raw response object returned by the API.
|
|
31645
|
+
*/
|
|
31646
|
+
get raw(): ResponseResource;
|
|
31647
|
+
/**
|
|
31648
|
+
* Automatically extracts the text content from the response.
|
|
31649
|
+
* It looks for the first "output_text" item in the response content.
|
|
31650
|
+
*/
|
|
31651
|
+
get text(): string | undefined;
|
|
31652
|
+
/**
|
|
31653
|
+
* The ID of the response.
|
|
31654
|
+
*/
|
|
31655
|
+
get id(): string | undefined;
|
|
31656
|
+
/**
|
|
31657
|
+
* The model used to generate the response.
|
|
31658
|
+
*/
|
|
31659
|
+
get model(): string | undefined;
|
|
31660
|
+
}
|
|
31661
|
+
/**
|
|
31662
|
+
* Options for sending a message or creating a session.
|
|
31663
|
+
*/
|
|
31664
|
+
type MessageOptions = Omit<CreateResponseBody, "input" | "stream">;
|
|
31665
|
+
/**
|
|
31666
|
+
* The main client for interacting with the Tekimax API.
|
|
31667
|
+
*/
|
|
31636
31668
|
declare class TekimaxClient {
|
|
31637
31669
|
private baseUrl;
|
|
31638
31670
|
private headers;
|
|
31671
|
+
/**
|
|
31672
|
+
* Creates a new TekimaxClient.
|
|
31673
|
+
*
|
|
31674
|
+
* @param options - Configuration options for the client.
|
|
31675
|
+
* @param options.baseUrl - The base URL of the API (default: "https://api.tekimax.com").
|
|
31676
|
+
* @param options.apiKey - Your Tekimax API key.
|
|
31677
|
+
*
|
|
31678
|
+
* @example
|
|
31679
|
+
* const client = new TekimaxClient({ apiKey: "tm_..." });
|
|
31680
|
+
*/
|
|
31639
31681
|
constructor(options?: {
|
|
31640
31682
|
baseUrl?: string;
|
|
31641
31683
|
apiKey?: string;
|
|
31642
31684
|
});
|
|
31643
31685
|
private request;
|
|
31644
|
-
|
|
31645
|
-
|
|
31686
|
+
/**
|
|
31687
|
+
* Creates a new session and sends the initial message.
|
|
31688
|
+
*
|
|
31689
|
+
* @param message - The initial message text to start the session.
|
|
31690
|
+
* @param options - Additional configuration options (model, temperature, etc.).
|
|
31691
|
+
*
|
|
31692
|
+
* @example
|
|
31693
|
+
* const response = await client.createSession("Hello, world!", { model: "gpt-4" });
|
|
31694
|
+
* console.log(response.text);
|
|
31695
|
+
*/
|
|
31696
|
+
createSession(message: string, options?: MessageOptions): Promise<TekimaxResponse>;
|
|
31697
|
+
/**
|
|
31698
|
+
* Sends a message to an existing session or starts a new one if no previous_response_id is provided.
|
|
31699
|
+
*
|
|
31700
|
+
* @param message - The message text to send.
|
|
31701
|
+
* @param options - Additional configuration options.
|
|
31702
|
+
*
|
|
31703
|
+
* @example
|
|
31704
|
+
* const response = await client.sendMessage("What is the weather?", {
|
|
31705
|
+
* previous_response_id: "resp_123"
|
|
31706
|
+
* });
|
|
31707
|
+
* console.log(response.text);
|
|
31708
|
+
*/
|
|
31709
|
+
sendMessage(message: string, options?: MessageOptions): Promise<TekimaxResponse>;
|
|
31646
31710
|
}
|
|
31647
31711
|
|
|
31648
|
-
export { type AllowedToolChoice, type AllowedToolChoiceTypeEnumKey, type AllowedToolsParam, type AllowedToolsParamTypeEnumKey, type Annotation, type AssistantMessageItemParam, type AssistantMessageItemParamRoleEnumKey, type AssistantMessageItemParamTypeEnumKey, type CreateResponseBody, type Createresponse200, type CreateresponseMutation, type CreateresponseMutationRequest, type CreateresponseMutationResponse, type DetailEnum, type DetailEnumEnumKey, type DeveloperMessageItemParam, type DeveloperMessageItemParamRoleEnumKey, type DeveloperMessageItemParamTypeEnumKey, type EmptyModelParam, type Error, type ErrorPayload, type ErrorStreamingEvent, type ErrorStreamingEventTypeEnumKey, type FunctionCall, type FunctionCallItemParam, type FunctionCallItemParamTypeEnumKey, type FunctionCallItemStatus, type FunctionCallItemStatusEnumKey, type FunctionCallOutput, type FunctionCallOutputItemParam, type FunctionCallOutputItemParamTypeEnumKey, type FunctionCallOutputStatusEnum, type FunctionCallOutputStatusEnumEnumKey, type FunctionCallOutputTypeEnumKey, type FunctionCallStatus, type FunctionCallStatusEnumKey, type FunctionCallTypeEnumKey, type FunctionTool, type FunctionToolChoice, type FunctionToolChoiceTypeEnumKey, type FunctionToolParam, type FunctionToolParamTypeEnumKey, type FunctionToolTypeEnumKey, type ImageDetail, type ImageDetailEnumKey, type IncludeEnum, type IncludeEnumEnumKey, type IncompleteDetails, type InputFileContent, type InputFileContentParam, type InputFileContentParamTypeEnumKey, type InputFileContentTypeEnumKey, type InputImageContent, type InputImageContentParamAutoParam, type InputImageContentParamAutoParamTypeEnumKey, type InputImageContentTypeEnumKey, type InputTextContent, type InputTextContentParam, type InputTextContentParamTypeEnumKey, type InputTextContentTypeEnumKey, type InputTokensDetails, type InputVideoContent, type InputVideoContentTypeEnumKey, type ItemField, type ItemParam, type ItemReferenceParam, type ItemReferenceParamTypeEnumKey, type JsonObjectResponseFormat, type JsonObjectResponseFormatTypeEnumKey, type JsonSchemaResponseFormat, type JsonSchemaResponseFormatParam, type JsonSchemaResponseFormatParamTypeEnumKey, type JsonSchemaResponseFormatTypeEnumKey, type LogProb, type Message, type MessageRole, type MessageRoleEnumKey, type MessageStatus, type MessageStatusEnumKey, type MessageTypeEnumKey, type MetadataParam, type OutputTextContent, type OutputTextContentParam, type OutputTextContentParamTypeEnumKey, type OutputTextContentTypeEnumKey, type OutputTokensDetails, type Reasoning, type ReasoningBody, type ReasoningBodyTypeEnumKey, type ReasoningEffortEnum, type ReasoningEffortEnumEnumKey, type ReasoningItemParam, type ReasoningItemParamTypeEnumKey, type ReasoningParam, type ReasoningSummaryContentParam, type ReasoningSummaryContentParamTypeEnumKey, type ReasoningSummaryEnum, type ReasoningSummaryEnumEnumKey, type ReasoningTextContent, type ReasoningTextContentTypeEnumKey, type RefusalContent, type RefusalContentParam, type RefusalContentParamTypeEnumKey, type RefusalContentTypeEnumKey, type ResponseCompletedStreamingEvent, type ResponseCompletedStreamingEventTypeEnumKey, type ResponseContentPartAddedStreamingEvent, type ResponseContentPartAddedStreamingEventTypeEnumKey, type ResponseContentPartDoneStreamingEvent, type ResponseContentPartDoneStreamingEventTypeEnumKey, type ResponseCreatedStreamingEvent, type ResponseCreatedStreamingEventTypeEnumKey, type ResponseFailedStreamingEvent, type ResponseFailedStreamingEventTypeEnumKey, type ResponseFunctionCallArgumentsDeltaStreamingEvent, type ResponseFunctionCallArgumentsDeltaStreamingEventTypeEnumKey, type ResponseFunctionCallArgumentsDoneStreamingEvent, type ResponseFunctionCallArgumentsDoneStreamingEventTypeEnumKey, type ResponseInProgressStreamingEvent, type ResponseInProgressStreamingEventTypeEnumKey, type ResponseIncompleteStreamingEvent, type ResponseIncompleteStreamingEventTypeEnumKey, type ResponseOutputItemAddedStreamingEvent, type ResponseOutputItemAddedStreamingEventTypeEnumKey, type ResponseOutputItemDoneStreamingEvent, type ResponseOutputItemDoneStreamingEventTypeEnumKey, type ResponseOutputTextAnnotationAddedStreamingEvent, type ResponseOutputTextAnnotationAddedStreamingEventTypeEnumKey, type ResponseOutputTextDeltaStreamingEvent, type ResponseOutputTextDeltaStreamingEventTypeEnumKey, type ResponseOutputTextDoneStreamingEvent, type ResponseOutputTextDoneStreamingEventTypeEnumKey, type ResponseQueuedStreamingEvent, type ResponseQueuedStreamingEventTypeEnumKey, type ResponseReasoningDeltaStreamingEvent, type ResponseReasoningDeltaStreamingEventTypeEnumKey, type ResponseReasoningDoneStreamingEvent, type ResponseReasoningDoneStreamingEventTypeEnumKey, type ResponseReasoningSummaryDeltaStreamingEvent, type ResponseReasoningSummaryDeltaStreamingEventTypeEnumKey, type ResponseReasoningSummaryDoneStreamingEvent, type ResponseReasoningSummaryDoneStreamingEventTypeEnumKey, type ResponseReasoningSummaryPartAddedStreamingEvent, type ResponseReasoningSummaryPartAddedStreamingEventTypeEnumKey, type ResponseReasoningSummaryPartDoneStreamingEvent, type ResponseReasoningSummaryPartDoneStreamingEventTypeEnumKey, type ResponseRefusalDeltaStreamingEvent, type ResponseRefusalDeltaStreamingEventTypeEnumKey, type ResponseRefusalDoneStreamingEvent, type ResponseRefusalDoneStreamingEventTypeEnumKey, type ResponseResource, type ResponseResourceObjectEnumKey, type ResponsesToolParam, type ServiceTierEnum, type ServiceTierEnumEnumKey, type SpecificFunctionParam, type SpecificFunctionParamTypeEnumKey, type SpecificToolChoiceParam, type StreamOptionsParam, type SummaryTextContent, type SummaryTextContentTypeEnumKey, type SystemMessageItemParam, type SystemMessageItemParamRoleEnumKey, type SystemMessageItemParamTypeEnumKey, TekimaxClient, type TextContent, type TextContentTypeEnumKey, type TextField, type TextFormatParam, type TextParam, type TextResponseFormat, type TextResponseFormatTypeEnumKey, type Tool, type ToolChoiceParam, type ToolChoiceValueEnum, type ToolChoiceValueEnumEnumKey, type TopLogProb, type TruncationEnum, type TruncationEnumEnumKey, type UrlCitationBody, type UrlCitationBodyTypeEnumKey, type UrlCitationParam, type UrlCitationParamTypeEnumKey, type Usage, type UserMessageItemParam, type UserMessageItemParamRoleEnumKey, type UserMessageItemParamTypeEnumKey, type VerbosityEnum, type VerbosityEnumEnumKey, allowedToolChoiceSchema, allowedToolChoiceTypeEnum, allowedToolsParamSchema, allowedToolsParamTypeEnum, annotationSchema, assistantMessageItemParamRoleEnum, assistantMessageItemParamSchema, assistantMessageItemParamTypeEnum, createResponseBodySchema, createresponse200Schema, createresponseMutationRequestSchema, createresponseMutationResponseSchema, detailEnumEnum, detailEnumSchema, developerMessageItemParamRoleEnum, developerMessageItemParamSchema, developerMessageItemParamTypeEnum, emptyModelParamSchema, errorPayloadSchema, errorSchema, errorStreamingEventSchema, errorStreamingEventTypeEnum, functionCallItemParamSchema, functionCallItemParamTypeEnum, functionCallItemStatusEnum, functionCallItemStatusSchema, functionCallOutputItemParamSchema, functionCallOutputItemParamTypeEnum, functionCallOutputSchema, functionCallOutputStatusEnumEnum, functionCallOutputStatusEnumSchema, functionCallOutputTypeEnum, functionCallSchema, functionCallStatusEnum, functionCallStatusSchema, functionCallTypeEnum, functionToolChoiceSchema, functionToolChoiceTypeEnum, functionToolParamSchema, functionToolParamTypeEnum, functionToolSchema, functionToolTypeEnum, imageDetailEnum, imageDetailSchema, includeEnumEnum, includeEnumSchema, incompleteDetailsSchema, inputFileContentParamSchema, inputFileContentParamTypeEnum, inputFileContentSchema, inputFileContentTypeEnum, inputImageContentParamAutoParamSchema, inputImageContentParamAutoParamTypeEnum, inputImageContentSchema, inputImageContentTypeEnum, inputTextContentParamSchema, inputTextContentParamTypeEnum, inputTextContentSchema, inputTextContentTypeEnum, inputTokensDetailsSchema, inputVideoContentSchema, inputVideoContentTypeEnum, itemFieldSchema, itemParamSchema, itemReferenceParamSchema, itemReferenceParamTypeEnum, jsonObjectResponseFormatSchema, jsonObjectResponseFormatTypeEnum, jsonSchemaResponseFormatParamSchema, jsonSchemaResponseFormatParamTypeEnum, jsonSchemaResponseFormatSchema, jsonSchemaResponseFormatTypeEnum, logProbSchema, messageRoleEnum, messageRoleSchema, messageSchema, messageStatusEnum, messageStatusSchema, messageTypeEnum, metadataParamSchema, outputTextContentParamSchema, outputTextContentParamTypeEnum, outputTextContentSchema, outputTextContentTypeEnum, outputTokensDetailsSchema, reasoningBodySchema, reasoningBodyTypeEnum, reasoningEffortEnumEnum, reasoningEffortEnumSchema, reasoningItemParamSchema, reasoningItemParamTypeEnum, reasoningParamSchema, reasoningSchema, reasoningSummaryContentParamSchema, reasoningSummaryContentParamTypeEnum, reasoningSummaryEnumEnum, reasoningSummaryEnumSchema, reasoningTextContentSchema, reasoningTextContentTypeEnum, refusalContentParamSchema, refusalContentParamTypeEnum, refusalContentSchema, refusalContentTypeEnum, responseCompletedStreamingEventSchema, responseCompletedStreamingEventTypeEnum, responseContentPartAddedStreamingEventSchema, responseContentPartAddedStreamingEventTypeEnum, responseContentPartDoneStreamingEventSchema, responseContentPartDoneStreamingEventTypeEnum, responseCreatedStreamingEventSchema, responseCreatedStreamingEventTypeEnum, responseFailedStreamingEventSchema, responseFailedStreamingEventTypeEnum, responseFunctionCallArgumentsDeltaStreamingEventSchema, responseFunctionCallArgumentsDeltaStreamingEventTypeEnum, responseFunctionCallArgumentsDoneStreamingEventSchema, responseFunctionCallArgumentsDoneStreamingEventTypeEnum, responseInProgressStreamingEventSchema, responseInProgressStreamingEventTypeEnum, responseIncompleteStreamingEventSchema, responseIncompleteStreamingEventTypeEnum, responseOutputItemAddedStreamingEventSchema, responseOutputItemAddedStreamingEventTypeEnum, responseOutputItemDoneStreamingEventSchema, responseOutputItemDoneStreamingEventTypeEnum, responseOutputTextAnnotationAddedStreamingEventSchema, responseOutputTextAnnotationAddedStreamingEventTypeEnum, responseOutputTextDeltaStreamingEventSchema, responseOutputTextDeltaStreamingEventTypeEnum, responseOutputTextDoneStreamingEventSchema, responseOutputTextDoneStreamingEventTypeEnum, responseQueuedStreamingEventSchema, responseQueuedStreamingEventTypeEnum, responseReasoningDeltaStreamingEventSchema, responseReasoningDeltaStreamingEventTypeEnum, responseReasoningDoneStreamingEventSchema, responseReasoningDoneStreamingEventTypeEnum, responseReasoningSummaryDeltaStreamingEventSchema, responseReasoningSummaryDeltaStreamingEventTypeEnum, responseReasoningSummaryDoneStreamingEventSchema, responseReasoningSummaryDoneStreamingEventTypeEnum, responseReasoningSummaryPartAddedStreamingEventSchema, responseReasoningSummaryPartAddedStreamingEventTypeEnum, responseReasoningSummaryPartDoneStreamingEventSchema, responseReasoningSummaryPartDoneStreamingEventTypeEnum, responseRefusalDeltaStreamingEventSchema, responseRefusalDeltaStreamingEventTypeEnum, responseRefusalDoneStreamingEventSchema, responseRefusalDoneStreamingEventTypeEnum, responseResourceObjectEnum, responseResourceSchema, responsesToolParamSchema, serviceTierEnumEnum, serviceTierEnumSchema, specificFunctionParamSchema, specificFunctionParamTypeEnum, specificToolChoiceParamSchema, streamOptionsParamSchema, summaryTextContentSchema, summaryTextContentTypeEnum, systemMessageItemParamRoleEnum, systemMessageItemParamSchema, systemMessageItemParamTypeEnum, textContentSchema, textContentTypeEnum, textFieldSchema, textFormatParamSchema, textParamSchema, textResponseFormatSchema, textResponseFormatTypeEnum, toolChoiceParamSchema, toolChoiceValueEnumEnum, toolChoiceValueEnumSchema, toolSchema, topLogProbSchema, truncationEnumEnum, truncationEnumSchema, urlCitationBodySchema, urlCitationBodyTypeEnum, urlCitationParamSchema, urlCitationParamTypeEnum, usageSchema, userMessageItemParamRoleEnum, userMessageItemParamSchema, userMessageItemParamTypeEnum, verbosityEnumEnum, verbosityEnumSchema };
|
|
31712
|
+
export { type AllowedToolChoice, type AllowedToolChoiceTypeEnumKey, type AllowedToolsParam, type AllowedToolsParamTypeEnumKey, type Annotation, type AssistantMessageItemParam, type AssistantMessageItemParamRoleEnumKey, type AssistantMessageItemParamTypeEnumKey, type CreateResponseBody, type Createresponse200, type CreateresponseMutation, type CreateresponseMutationRequest, type CreateresponseMutationResponse, type DetailEnum, type DetailEnumEnumKey, type DeveloperMessageItemParam, type DeveloperMessageItemParamRoleEnumKey, type DeveloperMessageItemParamTypeEnumKey, type EmptyModelParam, type Error, type ErrorPayload, type ErrorStreamingEvent, type ErrorStreamingEventTypeEnumKey, type FunctionCall, type FunctionCallItemParam, type FunctionCallItemParamTypeEnumKey, type FunctionCallItemStatus, type FunctionCallItemStatusEnumKey, type FunctionCallOutput, type FunctionCallOutputItemParam, type FunctionCallOutputItemParamTypeEnumKey, type FunctionCallOutputStatusEnum, type FunctionCallOutputStatusEnumEnumKey, type FunctionCallOutputTypeEnumKey, type FunctionCallStatus, type FunctionCallStatusEnumKey, type FunctionCallTypeEnumKey, type FunctionTool, type FunctionToolChoice, type FunctionToolChoiceTypeEnumKey, type FunctionToolParam, type FunctionToolParamTypeEnumKey, type FunctionToolTypeEnumKey, type ImageDetail, type ImageDetailEnumKey, type IncludeEnum, type IncludeEnumEnumKey, type IncompleteDetails, type InputFileContent, type InputFileContentParam, type InputFileContentParamTypeEnumKey, type InputFileContentTypeEnumKey, type InputImageContent, type InputImageContentParamAutoParam, type InputImageContentParamAutoParamTypeEnumKey, type InputImageContentTypeEnumKey, type InputTextContent, type InputTextContentParam, type InputTextContentParamTypeEnumKey, type InputTextContentTypeEnumKey, type InputTokensDetails, type InputVideoContent, type InputVideoContentTypeEnumKey, type ItemField, type ItemParam, type ItemReferenceParam, type ItemReferenceParamTypeEnumKey, type JsonObjectResponseFormat, type JsonObjectResponseFormatTypeEnumKey, type JsonSchemaResponseFormat, type JsonSchemaResponseFormatParam, type JsonSchemaResponseFormatParamTypeEnumKey, type JsonSchemaResponseFormatTypeEnumKey, type LogProb, type Message, type MessageRole, type MessageRoleEnumKey, type MessageStatus, type MessageStatusEnumKey, type MessageTypeEnumKey, type MetadataParam, type OutputTextContent, type OutputTextContentParam, type OutputTextContentParamTypeEnumKey, type OutputTextContentTypeEnumKey, type OutputTokensDetails, type Reasoning, type ReasoningBody, type ReasoningBodyTypeEnumKey, type ReasoningEffortEnum, type ReasoningEffortEnumEnumKey, type ReasoningItemParam, type ReasoningItemParamTypeEnumKey, type ReasoningParam, type ReasoningSummaryContentParam, type ReasoningSummaryContentParamTypeEnumKey, type ReasoningSummaryEnum, type ReasoningSummaryEnumEnumKey, type ReasoningTextContent, type ReasoningTextContentTypeEnumKey, type RefusalContent, type RefusalContentParam, type RefusalContentParamTypeEnumKey, type RefusalContentTypeEnumKey, type ResponseCompletedStreamingEvent, type ResponseCompletedStreamingEventTypeEnumKey, type ResponseContentPartAddedStreamingEvent, type ResponseContentPartAddedStreamingEventTypeEnumKey, type ResponseContentPartDoneStreamingEvent, type ResponseContentPartDoneStreamingEventTypeEnumKey, type ResponseCreatedStreamingEvent, type ResponseCreatedStreamingEventTypeEnumKey, type ResponseFailedStreamingEvent, type ResponseFailedStreamingEventTypeEnumKey, type ResponseFunctionCallArgumentsDeltaStreamingEvent, type ResponseFunctionCallArgumentsDeltaStreamingEventTypeEnumKey, type ResponseFunctionCallArgumentsDoneStreamingEvent, type ResponseFunctionCallArgumentsDoneStreamingEventTypeEnumKey, type ResponseInProgressStreamingEvent, type ResponseInProgressStreamingEventTypeEnumKey, type ResponseIncompleteStreamingEvent, type ResponseIncompleteStreamingEventTypeEnumKey, type ResponseOutputItemAddedStreamingEvent, type ResponseOutputItemAddedStreamingEventTypeEnumKey, type ResponseOutputItemDoneStreamingEvent, type ResponseOutputItemDoneStreamingEventTypeEnumKey, type ResponseOutputTextAnnotationAddedStreamingEvent, type ResponseOutputTextAnnotationAddedStreamingEventTypeEnumKey, type ResponseOutputTextDeltaStreamingEvent, type ResponseOutputTextDeltaStreamingEventTypeEnumKey, type ResponseOutputTextDoneStreamingEvent, type ResponseOutputTextDoneStreamingEventTypeEnumKey, type ResponseQueuedStreamingEvent, type ResponseQueuedStreamingEventTypeEnumKey, type ResponseReasoningDeltaStreamingEvent, type ResponseReasoningDeltaStreamingEventTypeEnumKey, type ResponseReasoningDoneStreamingEvent, type ResponseReasoningDoneStreamingEventTypeEnumKey, type ResponseReasoningSummaryDeltaStreamingEvent, type ResponseReasoningSummaryDeltaStreamingEventTypeEnumKey, type ResponseReasoningSummaryDoneStreamingEvent, type ResponseReasoningSummaryDoneStreamingEventTypeEnumKey, type ResponseReasoningSummaryPartAddedStreamingEvent, type ResponseReasoningSummaryPartAddedStreamingEventTypeEnumKey, type ResponseReasoningSummaryPartDoneStreamingEvent, type ResponseReasoningSummaryPartDoneStreamingEventTypeEnumKey, type ResponseRefusalDeltaStreamingEvent, type ResponseRefusalDeltaStreamingEventTypeEnumKey, type ResponseRefusalDoneStreamingEvent, type ResponseRefusalDoneStreamingEventTypeEnumKey, type ResponseResource, type ResponseResourceObjectEnumKey, type ResponsesToolParam, type ServiceTierEnum, type ServiceTierEnumEnumKey, type SpecificFunctionParam, type SpecificFunctionParamTypeEnumKey, type SpecificToolChoiceParam, type StreamOptionsParam, type SummaryTextContent, type SummaryTextContentTypeEnumKey, type SystemMessageItemParam, type SystemMessageItemParamRoleEnumKey, type SystemMessageItemParamTypeEnumKey, TekimaxClient, TekimaxResponse, type TextContent, type TextContentTypeEnumKey, type TextField, type TextFormatParam, type TextParam, type TextResponseFormat, type TextResponseFormatTypeEnumKey, type Tool, type ToolChoiceParam, type ToolChoiceValueEnum, type ToolChoiceValueEnumEnumKey, type TopLogProb, type TruncationEnum, type TruncationEnumEnumKey, type UrlCitationBody, type UrlCitationBodyTypeEnumKey, type UrlCitationParam, type UrlCitationParamTypeEnumKey, type Usage, type UserMessageItemParam, type UserMessageItemParamRoleEnumKey, type UserMessageItemParamTypeEnumKey, type VerbosityEnum, type VerbosityEnumEnumKey, allowedToolChoiceSchema, allowedToolChoiceTypeEnum, allowedToolsParamSchema, allowedToolsParamTypeEnum, annotationSchema, assistantMessageItemParamRoleEnum, assistantMessageItemParamSchema, assistantMessageItemParamTypeEnum, createResponseBodySchema, createresponse200Schema, createresponseMutationRequestSchema, createresponseMutationResponseSchema, detailEnumEnum, detailEnumSchema, developerMessageItemParamRoleEnum, developerMessageItemParamSchema, developerMessageItemParamTypeEnum, emptyModelParamSchema, errorPayloadSchema, errorSchema, errorStreamingEventSchema, errorStreamingEventTypeEnum, functionCallItemParamSchema, functionCallItemParamTypeEnum, functionCallItemStatusEnum, functionCallItemStatusSchema, functionCallOutputItemParamSchema, functionCallOutputItemParamTypeEnum, functionCallOutputSchema, functionCallOutputStatusEnumEnum, functionCallOutputStatusEnumSchema, functionCallOutputTypeEnum, functionCallSchema, functionCallStatusEnum, functionCallStatusSchema, functionCallTypeEnum, functionToolChoiceSchema, functionToolChoiceTypeEnum, functionToolParamSchema, functionToolParamTypeEnum, functionToolSchema, functionToolTypeEnum, imageDetailEnum, imageDetailSchema, includeEnumEnum, includeEnumSchema, incompleteDetailsSchema, inputFileContentParamSchema, inputFileContentParamTypeEnum, inputFileContentSchema, inputFileContentTypeEnum, inputImageContentParamAutoParamSchema, inputImageContentParamAutoParamTypeEnum, inputImageContentSchema, inputImageContentTypeEnum, inputTextContentParamSchema, inputTextContentParamTypeEnum, inputTextContentSchema, inputTextContentTypeEnum, inputTokensDetailsSchema, inputVideoContentSchema, inputVideoContentTypeEnum, itemFieldSchema, itemParamSchema, itemReferenceParamSchema, itemReferenceParamTypeEnum, jsonObjectResponseFormatSchema, jsonObjectResponseFormatTypeEnum, jsonSchemaResponseFormatParamSchema, jsonSchemaResponseFormatParamTypeEnum, jsonSchemaResponseFormatSchema, jsonSchemaResponseFormatTypeEnum, logProbSchema, messageRoleEnum, messageRoleSchema, messageSchema, messageStatusEnum, messageStatusSchema, messageTypeEnum, metadataParamSchema, outputTextContentParamSchema, outputTextContentParamTypeEnum, outputTextContentSchema, outputTextContentTypeEnum, outputTokensDetailsSchema, reasoningBodySchema, reasoningBodyTypeEnum, reasoningEffortEnumEnum, reasoningEffortEnumSchema, reasoningItemParamSchema, reasoningItemParamTypeEnum, reasoningParamSchema, reasoningSchema, reasoningSummaryContentParamSchema, reasoningSummaryContentParamTypeEnum, reasoningSummaryEnumEnum, reasoningSummaryEnumSchema, reasoningTextContentSchema, reasoningTextContentTypeEnum, refusalContentParamSchema, refusalContentParamTypeEnum, refusalContentSchema, refusalContentTypeEnum, responseCompletedStreamingEventSchema, responseCompletedStreamingEventTypeEnum, responseContentPartAddedStreamingEventSchema, responseContentPartAddedStreamingEventTypeEnum, responseContentPartDoneStreamingEventSchema, responseContentPartDoneStreamingEventTypeEnum, responseCreatedStreamingEventSchema, responseCreatedStreamingEventTypeEnum, responseFailedStreamingEventSchema, responseFailedStreamingEventTypeEnum, responseFunctionCallArgumentsDeltaStreamingEventSchema, responseFunctionCallArgumentsDeltaStreamingEventTypeEnum, responseFunctionCallArgumentsDoneStreamingEventSchema, responseFunctionCallArgumentsDoneStreamingEventTypeEnum, responseInProgressStreamingEventSchema, responseInProgressStreamingEventTypeEnum, responseIncompleteStreamingEventSchema, responseIncompleteStreamingEventTypeEnum, responseOutputItemAddedStreamingEventSchema, responseOutputItemAddedStreamingEventTypeEnum, responseOutputItemDoneStreamingEventSchema, responseOutputItemDoneStreamingEventTypeEnum, responseOutputTextAnnotationAddedStreamingEventSchema, responseOutputTextAnnotationAddedStreamingEventTypeEnum, responseOutputTextDeltaStreamingEventSchema, responseOutputTextDeltaStreamingEventTypeEnum, responseOutputTextDoneStreamingEventSchema, responseOutputTextDoneStreamingEventTypeEnum, responseQueuedStreamingEventSchema, responseQueuedStreamingEventTypeEnum, responseReasoningDeltaStreamingEventSchema, responseReasoningDeltaStreamingEventTypeEnum, responseReasoningDoneStreamingEventSchema, responseReasoningDoneStreamingEventTypeEnum, responseReasoningSummaryDeltaStreamingEventSchema, responseReasoningSummaryDeltaStreamingEventTypeEnum, responseReasoningSummaryDoneStreamingEventSchema, responseReasoningSummaryDoneStreamingEventTypeEnum, responseReasoningSummaryPartAddedStreamingEventSchema, responseReasoningSummaryPartAddedStreamingEventTypeEnum, responseReasoningSummaryPartDoneStreamingEventSchema, responseReasoningSummaryPartDoneStreamingEventTypeEnum, responseRefusalDeltaStreamingEventSchema, responseRefusalDeltaStreamingEventTypeEnum, responseRefusalDoneStreamingEventSchema, responseRefusalDoneStreamingEventTypeEnum, responseResourceObjectEnum, responseResourceSchema, responsesToolParamSchema, serviceTierEnumEnum, serviceTierEnumSchema, specificFunctionParamSchema, specificFunctionParamTypeEnum, specificToolChoiceParamSchema, streamOptionsParamSchema, summaryTextContentSchema, summaryTextContentTypeEnum, systemMessageItemParamRoleEnum, systemMessageItemParamSchema, systemMessageItemParamTypeEnum, textContentSchema, textContentTypeEnum, textFieldSchema, textFormatParamSchema, textParamSchema, textResponseFormatSchema, textResponseFormatTypeEnum, toolChoiceParamSchema, toolChoiceValueEnumEnum, toolChoiceValueEnumSchema, toolSchema, topLogProbSchema, truncationEnumEnum, truncationEnumSchema, urlCitationBodySchema, urlCitationBodyTypeEnum, urlCitationParamSchema, urlCitationParamTypeEnum, usageSchema, userMessageItemParamRoleEnum, userMessageItemParamSchema, userMessageItemParamTypeEnum, verbosityEnumEnum, verbosityEnumSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -31633,16 +31633,80 @@ declare const userMessageItemParamSchema: z.ZodObject<{
|
|
|
31633
31633
|
|
|
31634
31634
|
declare const verbosityEnumSchema: z.ZodEnum<["low", "medium", "high"]>;
|
|
31635
31635
|
|
|
31636
|
+
/**
|
|
31637
|
+
* A wrapper around the raw API response that provides helper methods
|
|
31638
|
+
* for common tasks like extracting text content.
|
|
31639
|
+
*/
|
|
31640
|
+
declare class TekimaxResponse {
|
|
31641
|
+
private readonly _raw;
|
|
31642
|
+
constructor(_raw: ResponseResource);
|
|
31643
|
+
/**
|
|
31644
|
+
* Access the raw response object returned by the API.
|
|
31645
|
+
*/
|
|
31646
|
+
get raw(): ResponseResource;
|
|
31647
|
+
/**
|
|
31648
|
+
* Automatically extracts the text content from the response.
|
|
31649
|
+
* It looks for the first "output_text" item in the response content.
|
|
31650
|
+
*/
|
|
31651
|
+
get text(): string | undefined;
|
|
31652
|
+
/**
|
|
31653
|
+
* The ID of the response.
|
|
31654
|
+
*/
|
|
31655
|
+
get id(): string | undefined;
|
|
31656
|
+
/**
|
|
31657
|
+
* The model used to generate the response.
|
|
31658
|
+
*/
|
|
31659
|
+
get model(): string | undefined;
|
|
31660
|
+
}
|
|
31661
|
+
/**
|
|
31662
|
+
* Options for sending a message or creating a session.
|
|
31663
|
+
*/
|
|
31664
|
+
type MessageOptions = Omit<CreateResponseBody, "input" | "stream">;
|
|
31665
|
+
/**
|
|
31666
|
+
* The main client for interacting with the Tekimax API.
|
|
31667
|
+
*/
|
|
31636
31668
|
declare class TekimaxClient {
|
|
31637
31669
|
private baseUrl;
|
|
31638
31670
|
private headers;
|
|
31671
|
+
/**
|
|
31672
|
+
* Creates a new TekimaxClient.
|
|
31673
|
+
*
|
|
31674
|
+
* @param options - Configuration options for the client.
|
|
31675
|
+
* @param options.baseUrl - The base URL of the API (default: "https://api.tekimax.com").
|
|
31676
|
+
* @param options.apiKey - Your Tekimax API key.
|
|
31677
|
+
*
|
|
31678
|
+
* @example
|
|
31679
|
+
* const client = new TekimaxClient({ apiKey: "tm_..." });
|
|
31680
|
+
*/
|
|
31639
31681
|
constructor(options?: {
|
|
31640
31682
|
baseUrl?: string;
|
|
31641
31683
|
apiKey?: string;
|
|
31642
31684
|
});
|
|
31643
31685
|
private request;
|
|
31644
|
-
|
|
31645
|
-
|
|
31686
|
+
/**
|
|
31687
|
+
* Creates a new session and sends the initial message.
|
|
31688
|
+
*
|
|
31689
|
+
* @param message - The initial message text to start the session.
|
|
31690
|
+
* @param options - Additional configuration options (model, temperature, etc.).
|
|
31691
|
+
*
|
|
31692
|
+
* @example
|
|
31693
|
+
* const response = await client.createSession("Hello, world!", { model: "gpt-4" });
|
|
31694
|
+
* console.log(response.text);
|
|
31695
|
+
*/
|
|
31696
|
+
createSession(message: string, options?: MessageOptions): Promise<TekimaxResponse>;
|
|
31697
|
+
/**
|
|
31698
|
+
* Sends a message to an existing session or starts a new one if no previous_response_id is provided.
|
|
31699
|
+
*
|
|
31700
|
+
* @param message - The message text to send.
|
|
31701
|
+
* @param options - Additional configuration options.
|
|
31702
|
+
*
|
|
31703
|
+
* @example
|
|
31704
|
+
* const response = await client.sendMessage("What is the weather?", {
|
|
31705
|
+
* previous_response_id: "resp_123"
|
|
31706
|
+
* });
|
|
31707
|
+
* console.log(response.text);
|
|
31708
|
+
*/
|
|
31709
|
+
sendMessage(message: string, options?: MessageOptions): Promise<TekimaxResponse>;
|
|
31646
31710
|
}
|
|
31647
31711
|
|
|
31648
|
-
export { type AllowedToolChoice, type AllowedToolChoiceTypeEnumKey, type AllowedToolsParam, type AllowedToolsParamTypeEnumKey, type Annotation, type AssistantMessageItemParam, type AssistantMessageItemParamRoleEnumKey, type AssistantMessageItemParamTypeEnumKey, type CreateResponseBody, type Createresponse200, type CreateresponseMutation, type CreateresponseMutationRequest, type CreateresponseMutationResponse, type DetailEnum, type DetailEnumEnumKey, type DeveloperMessageItemParam, type DeveloperMessageItemParamRoleEnumKey, type DeveloperMessageItemParamTypeEnumKey, type EmptyModelParam, type Error, type ErrorPayload, type ErrorStreamingEvent, type ErrorStreamingEventTypeEnumKey, type FunctionCall, type FunctionCallItemParam, type FunctionCallItemParamTypeEnumKey, type FunctionCallItemStatus, type FunctionCallItemStatusEnumKey, type FunctionCallOutput, type FunctionCallOutputItemParam, type FunctionCallOutputItemParamTypeEnumKey, type FunctionCallOutputStatusEnum, type FunctionCallOutputStatusEnumEnumKey, type FunctionCallOutputTypeEnumKey, type FunctionCallStatus, type FunctionCallStatusEnumKey, type FunctionCallTypeEnumKey, type FunctionTool, type FunctionToolChoice, type FunctionToolChoiceTypeEnumKey, type FunctionToolParam, type FunctionToolParamTypeEnumKey, type FunctionToolTypeEnumKey, type ImageDetail, type ImageDetailEnumKey, type IncludeEnum, type IncludeEnumEnumKey, type IncompleteDetails, type InputFileContent, type InputFileContentParam, type InputFileContentParamTypeEnumKey, type InputFileContentTypeEnumKey, type InputImageContent, type InputImageContentParamAutoParam, type InputImageContentParamAutoParamTypeEnumKey, type InputImageContentTypeEnumKey, type InputTextContent, type InputTextContentParam, type InputTextContentParamTypeEnumKey, type InputTextContentTypeEnumKey, type InputTokensDetails, type InputVideoContent, type InputVideoContentTypeEnumKey, type ItemField, type ItemParam, type ItemReferenceParam, type ItemReferenceParamTypeEnumKey, type JsonObjectResponseFormat, type JsonObjectResponseFormatTypeEnumKey, type JsonSchemaResponseFormat, type JsonSchemaResponseFormatParam, type JsonSchemaResponseFormatParamTypeEnumKey, type JsonSchemaResponseFormatTypeEnumKey, type LogProb, type Message, type MessageRole, type MessageRoleEnumKey, type MessageStatus, type MessageStatusEnumKey, type MessageTypeEnumKey, type MetadataParam, type OutputTextContent, type OutputTextContentParam, type OutputTextContentParamTypeEnumKey, type OutputTextContentTypeEnumKey, type OutputTokensDetails, type Reasoning, type ReasoningBody, type ReasoningBodyTypeEnumKey, type ReasoningEffortEnum, type ReasoningEffortEnumEnumKey, type ReasoningItemParam, type ReasoningItemParamTypeEnumKey, type ReasoningParam, type ReasoningSummaryContentParam, type ReasoningSummaryContentParamTypeEnumKey, type ReasoningSummaryEnum, type ReasoningSummaryEnumEnumKey, type ReasoningTextContent, type ReasoningTextContentTypeEnumKey, type RefusalContent, type RefusalContentParam, type RefusalContentParamTypeEnumKey, type RefusalContentTypeEnumKey, type ResponseCompletedStreamingEvent, type ResponseCompletedStreamingEventTypeEnumKey, type ResponseContentPartAddedStreamingEvent, type ResponseContentPartAddedStreamingEventTypeEnumKey, type ResponseContentPartDoneStreamingEvent, type ResponseContentPartDoneStreamingEventTypeEnumKey, type ResponseCreatedStreamingEvent, type ResponseCreatedStreamingEventTypeEnumKey, type ResponseFailedStreamingEvent, type ResponseFailedStreamingEventTypeEnumKey, type ResponseFunctionCallArgumentsDeltaStreamingEvent, type ResponseFunctionCallArgumentsDeltaStreamingEventTypeEnumKey, type ResponseFunctionCallArgumentsDoneStreamingEvent, type ResponseFunctionCallArgumentsDoneStreamingEventTypeEnumKey, type ResponseInProgressStreamingEvent, type ResponseInProgressStreamingEventTypeEnumKey, type ResponseIncompleteStreamingEvent, type ResponseIncompleteStreamingEventTypeEnumKey, type ResponseOutputItemAddedStreamingEvent, type ResponseOutputItemAddedStreamingEventTypeEnumKey, type ResponseOutputItemDoneStreamingEvent, type ResponseOutputItemDoneStreamingEventTypeEnumKey, type ResponseOutputTextAnnotationAddedStreamingEvent, type ResponseOutputTextAnnotationAddedStreamingEventTypeEnumKey, type ResponseOutputTextDeltaStreamingEvent, type ResponseOutputTextDeltaStreamingEventTypeEnumKey, type ResponseOutputTextDoneStreamingEvent, type ResponseOutputTextDoneStreamingEventTypeEnumKey, type ResponseQueuedStreamingEvent, type ResponseQueuedStreamingEventTypeEnumKey, type ResponseReasoningDeltaStreamingEvent, type ResponseReasoningDeltaStreamingEventTypeEnumKey, type ResponseReasoningDoneStreamingEvent, type ResponseReasoningDoneStreamingEventTypeEnumKey, type ResponseReasoningSummaryDeltaStreamingEvent, type ResponseReasoningSummaryDeltaStreamingEventTypeEnumKey, type ResponseReasoningSummaryDoneStreamingEvent, type ResponseReasoningSummaryDoneStreamingEventTypeEnumKey, type ResponseReasoningSummaryPartAddedStreamingEvent, type ResponseReasoningSummaryPartAddedStreamingEventTypeEnumKey, type ResponseReasoningSummaryPartDoneStreamingEvent, type ResponseReasoningSummaryPartDoneStreamingEventTypeEnumKey, type ResponseRefusalDeltaStreamingEvent, type ResponseRefusalDeltaStreamingEventTypeEnumKey, type ResponseRefusalDoneStreamingEvent, type ResponseRefusalDoneStreamingEventTypeEnumKey, type ResponseResource, type ResponseResourceObjectEnumKey, type ResponsesToolParam, type ServiceTierEnum, type ServiceTierEnumEnumKey, type SpecificFunctionParam, type SpecificFunctionParamTypeEnumKey, type SpecificToolChoiceParam, type StreamOptionsParam, type SummaryTextContent, type SummaryTextContentTypeEnumKey, type SystemMessageItemParam, type SystemMessageItemParamRoleEnumKey, type SystemMessageItemParamTypeEnumKey, TekimaxClient, type TextContent, type TextContentTypeEnumKey, type TextField, type TextFormatParam, type TextParam, type TextResponseFormat, type TextResponseFormatTypeEnumKey, type Tool, type ToolChoiceParam, type ToolChoiceValueEnum, type ToolChoiceValueEnumEnumKey, type TopLogProb, type TruncationEnum, type TruncationEnumEnumKey, type UrlCitationBody, type UrlCitationBodyTypeEnumKey, type UrlCitationParam, type UrlCitationParamTypeEnumKey, type Usage, type UserMessageItemParam, type UserMessageItemParamRoleEnumKey, type UserMessageItemParamTypeEnumKey, type VerbosityEnum, type VerbosityEnumEnumKey, allowedToolChoiceSchema, allowedToolChoiceTypeEnum, allowedToolsParamSchema, allowedToolsParamTypeEnum, annotationSchema, assistantMessageItemParamRoleEnum, assistantMessageItemParamSchema, assistantMessageItemParamTypeEnum, createResponseBodySchema, createresponse200Schema, createresponseMutationRequestSchema, createresponseMutationResponseSchema, detailEnumEnum, detailEnumSchema, developerMessageItemParamRoleEnum, developerMessageItemParamSchema, developerMessageItemParamTypeEnum, emptyModelParamSchema, errorPayloadSchema, errorSchema, errorStreamingEventSchema, errorStreamingEventTypeEnum, functionCallItemParamSchema, functionCallItemParamTypeEnum, functionCallItemStatusEnum, functionCallItemStatusSchema, functionCallOutputItemParamSchema, functionCallOutputItemParamTypeEnum, functionCallOutputSchema, functionCallOutputStatusEnumEnum, functionCallOutputStatusEnumSchema, functionCallOutputTypeEnum, functionCallSchema, functionCallStatusEnum, functionCallStatusSchema, functionCallTypeEnum, functionToolChoiceSchema, functionToolChoiceTypeEnum, functionToolParamSchema, functionToolParamTypeEnum, functionToolSchema, functionToolTypeEnum, imageDetailEnum, imageDetailSchema, includeEnumEnum, includeEnumSchema, incompleteDetailsSchema, inputFileContentParamSchema, inputFileContentParamTypeEnum, inputFileContentSchema, inputFileContentTypeEnum, inputImageContentParamAutoParamSchema, inputImageContentParamAutoParamTypeEnum, inputImageContentSchema, inputImageContentTypeEnum, inputTextContentParamSchema, inputTextContentParamTypeEnum, inputTextContentSchema, inputTextContentTypeEnum, inputTokensDetailsSchema, inputVideoContentSchema, inputVideoContentTypeEnum, itemFieldSchema, itemParamSchema, itemReferenceParamSchema, itemReferenceParamTypeEnum, jsonObjectResponseFormatSchema, jsonObjectResponseFormatTypeEnum, jsonSchemaResponseFormatParamSchema, jsonSchemaResponseFormatParamTypeEnum, jsonSchemaResponseFormatSchema, jsonSchemaResponseFormatTypeEnum, logProbSchema, messageRoleEnum, messageRoleSchema, messageSchema, messageStatusEnum, messageStatusSchema, messageTypeEnum, metadataParamSchema, outputTextContentParamSchema, outputTextContentParamTypeEnum, outputTextContentSchema, outputTextContentTypeEnum, outputTokensDetailsSchema, reasoningBodySchema, reasoningBodyTypeEnum, reasoningEffortEnumEnum, reasoningEffortEnumSchema, reasoningItemParamSchema, reasoningItemParamTypeEnum, reasoningParamSchema, reasoningSchema, reasoningSummaryContentParamSchema, reasoningSummaryContentParamTypeEnum, reasoningSummaryEnumEnum, reasoningSummaryEnumSchema, reasoningTextContentSchema, reasoningTextContentTypeEnum, refusalContentParamSchema, refusalContentParamTypeEnum, refusalContentSchema, refusalContentTypeEnum, responseCompletedStreamingEventSchema, responseCompletedStreamingEventTypeEnum, responseContentPartAddedStreamingEventSchema, responseContentPartAddedStreamingEventTypeEnum, responseContentPartDoneStreamingEventSchema, responseContentPartDoneStreamingEventTypeEnum, responseCreatedStreamingEventSchema, responseCreatedStreamingEventTypeEnum, responseFailedStreamingEventSchema, responseFailedStreamingEventTypeEnum, responseFunctionCallArgumentsDeltaStreamingEventSchema, responseFunctionCallArgumentsDeltaStreamingEventTypeEnum, responseFunctionCallArgumentsDoneStreamingEventSchema, responseFunctionCallArgumentsDoneStreamingEventTypeEnum, responseInProgressStreamingEventSchema, responseInProgressStreamingEventTypeEnum, responseIncompleteStreamingEventSchema, responseIncompleteStreamingEventTypeEnum, responseOutputItemAddedStreamingEventSchema, responseOutputItemAddedStreamingEventTypeEnum, responseOutputItemDoneStreamingEventSchema, responseOutputItemDoneStreamingEventTypeEnum, responseOutputTextAnnotationAddedStreamingEventSchema, responseOutputTextAnnotationAddedStreamingEventTypeEnum, responseOutputTextDeltaStreamingEventSchema, responseOutputTextDeltaStreamingEventTypeEnum, responseOutputTextDoneStreamingEventSchema, responseOutputTextDoneStreamingEventTypeEnum, responseQueuedStreamingEventSchema, responseQueuedStreamingEventTypeEnum, responseReasoningDeltaStreamingEventSchema, responseReasoningDeltaStreamingEventTypeEnum, responseReasoningDoneStreamingEventSchema, responseReasoningDoneStreamingEventTypeEnum, responseReasoningSummaryDeltaStreamingEventSchema, responseReasoningSummaryDeltaStreamingEventTypeEnum, responseReasoningSummaryDoneStreamingEventSchema, responseReasoningSummaryDoneStreamingEventTypeEnum, responseReasoningSummaryPartAddedStreamingEventSchema, responseReasoningSummaryPartAddedStreamingEventTypeEnum, responseReasoningSummaryPartDoneStreamingEventSchema, responseReasoningSummaryPartDoneStreamingEventTypeEnum, responseRefusalDeltaStreamingEventSchema, responseRefusalDeltaStreamingEventTypeEnum, responseRefusalDoneStreamingEventSchema, responseRefusalDoneStreamingEventTypeEnum, responseResourceObjectEnum, responseResourceSchema, responsesToolParamSchema, serviceTierEnumEnum, serviceTierEnumSchema, specificFunctionParamSchema, specificFunctionParamTypeEnum, specificToolChoiceParamSchema, streamOptionsParamSchema, summaryTextContentSchema, summaryTextContentTypeEnum, systemMessageItemParamRoleEnum, systemMessageItemParamSchema, systemMessageItemParamTypeEnum, textContentSchema, textContentTypeEnum, textFieldSchema, textFormatParamSchema, textParamSchema, textResponseFormatSchema, textResponseFormatTypeEnum, toolChoiceParamSchema, toolChoiceValueEnumEnum, toolChoiceValueEnumSchema, toolSchema, topLogProbSchema, truncationEnumEnum, truncationEnumSchema, urlCitationBodySchema, urlCitationBodyTypeEnum, urlCitationParamSchema, urlCitationParamTypeEnum, usageSchema, userMessageItemParamRoleEnum, userMessageItemParamSchema, userMessageItemParamTypeEnum, verbosityEnumEnum, verbosityEnumSchema };
|
|
31712
|
+
export { type AllowedToolChoice, type AllowedToolChoiceTypeEnumKey, type AllowedToolsParam, type AllowedToolsParamTypeEnumKey, type Annotation, type AssistantMessageItemParam, type AssistantMessageItemParamRoleEnumKey, type AssistantMessageItemParamTypeEnumKey, type CreateResponseBody, type Createresponse200, type CreateresponseMutation, type CreateresponseMutationRequest, type CreateresponseMutationResponse, type DetailEnum, type DetailEnumEnumKey, type DeveloperMessageItemParam, type DeveloperMessageItemParamRoleEnumKey, type DeveloperMessageItemParamTypeEnumKey, type EmptyModelParam, type Error, type ErrorPayload, type ErrorStreamingEvent, type ErrorStreamingEventTypeEnumKey, type FunctionCall, type FunctionCallItemParam, type FunctionCallItemParamTypeEnumKey, type FunctionCallItemStatus, type FunctionCallItemStatusEnumKey, type FunctionCallOutput, type FunctionCallOutputItemParam, type FunctionCallOutputItemParamTypeEnumKey, type FunctionCallOutputStatusEnum, type FunctionCallOutputStatusEnumEnumKey, type FunctionCallOutputTypeEnumKey, type FunctionCallStatus, type FunctionCallStatusEnumKey, type FunctionCallTypeEnumKey, type FunctionTool, type FunctionToolChoice, type FunctionToolChoiceTypeEnumKey, type FunctionToolParam, type FunctionToolParamTypeEnumKey, type FunctionToolTypeEnumKey, type ImageDetail, type ImageDetailEnumKey, type IncludeEnum, type IncludeEnumEnumKey, type IncompleteDetails, type InputFileContent, type InputFileContentParam, type InputFileContentParamTypeEnumKey, type InputFileContentTypeEnumKey, type InputImageContent, type InputImageContentParamAutoParam, type InputImageContentParamAutoParamTypeEnumKey, type InputImageContentTypeEnumKey, type InputTextContent, type InputTextContentParam, type InputTextContentParamTypeEnumKey, type InputTextContentTypeEnumKey, type InputTokensDetails, type InputVideoContent, type InputVideoContentTypeEnumKey, type ItemField, type ItemParam, type ItemReferenceParam, type ItemReferenceParamTypeEnumKey, type JsonObjectResponseFormat, type JsonObjectResponseFormatTypeEnumKey, type JsonSchemaResponseFormat, type JsonSchemaResponseFormatParam, type JsonSchemaResponseFormatParamTypeEnumKey, type JsonSchemaResponseFormatTypeEnumKey, type LogProb, type Message, type MessageRole, type MessageRoleEnumKey, type MessageStatus, type MessageStatusEnumKey, type MessageTypeEnumKey, type MetadataParam, type OutputTextContent, type OutputTextContentParam, type OutputTextContentParamTypeEnumKey, type OutputTextContentTypeEnumKey, type OutputTokensDetails, type Reasoning, type ReasoningBody, type ReasoningBodyTypeEnumKey, type ReasoningEffortEnum, type ReasoningEffortEnumEnumKey, type ReasoningItemParam, type ReasoningItemParamTypeEnumKey, type ReasoningParam, type ReasoningSummaryContentParam, type ReasoningSummaryContentParamTypeEnumKey, type ReasoningSummaryEnum, type ReasoningSummaryEnumEnumKey, type ReasoningTextContent, type ReasoningTextContentTypeEnumKey, type RefusalContent, type RefusalContentParam, type RefusalContentParamTypeEnumKey, type RefusalContentTypeEnumKey, type ResponseCompletedStreamingEvent, type ResponseCompletedStreamingEventTypeEnumKey, type ResponseContentPartAddedStreamingEvent, type ResponseContentPartAddedStreamingEventTypeEnumKey, type ResponseContentPartDoneStreamingEvent, type ResponseContentPartDoneStreamingEventTypeEnumKey, type ResponseCreatedStreamingEvent, type ResponseCreatedStreamingEventTypeEnumKey, type ResponseFailedStreamingEvent, type ResponseFailedStreamingEventTypeEnumKey, type ResponseFunctionCallArgumentsDeltaStreamingEvent, type ResponseFunctionCallArgumentsDeltaStreamingEventTypeEnumKey, type ResponseFunctionCallArgumentsDoneStreamingEvent, type ResponseFunctionCallArgumentsDoneStreamingEventTypeEnumKey, type ResponseInProgressStreamingEvent, type ResponseInProgressStreamingEventTypeEnumKey, type ResponseIncompleteStreamingEvent, type ResponseIncompleteStreamingEventTypeEnumKey, type ResponseOutputItemAddedStreamingEvent, type ResponseOutputItemAddedStreamingEventTypeEnumKey, type ResponseOutputItemDoneStreamingEvent, type ResponseOutputItemDoneStreamingEventTypeEnumKey, type ResponseOutputTextAnnotationAddedStreamingEvent, type ResponseOutputTextAnnotationAddedStreamingEventTypeEnumKey, type ResponseOutputTextDeltaStreamingEvent, type ResponseOutputTextDeltaStreamingEventTypeEnumKey, type ResponseOutputTextDoneStreamingEvent, type ResponseOutputTextDoneStreamingEventTypeEnumKey, type ResponseQueuedStreamingEvent, type ResponseQueuedStreamingEventTypeEnumKey, type ResponseReasoningDeltaStreamingEvent, type ResponseReasoningDeltaStreamingEventTypeEnumKey, type ResponseReasoningDoneStreamingEvent, type ResponseReasoningDoneStreamingEventTypeEnumKey, type ResponseReasoningSummaryDeltaStreamingEvent, type ResponseReasoningSummaryDeltaStreamingEventTypeEnumKey, type ResponseReasoningSummaryDoneStreamingEvent, type ResponseReasoningSummaryDoneStreamingEventTypeEnumKey, type ResponseReasoningSummaryPartAddedStreamingEvent, type ResponseReasoningSummaryPartAddedStreamingEventTypeEnumKey, type ResponseReasoningSummaryPartDoneStreamingEvent, type ResponseReasoningSummaryPartDoneStreamingEventTypeEnumKey, type ResponseRefusalDeltaStreamingEvent, type ResponseRefusalDeltaStreamingEventTypeEnumKey, type ResponseRefusalDoneStreamingEvent, type ResponseRefusalDoneStreamingEventTypeEnumKey, type ResponseResource, type ResponseResourceObjectEnumKey, type ResponsesToolParam, type ServiceTierEnum, type ServiceTierEnumEnumKey, type SpecificFunctionParam, type SpecificFunctionParamTypeEnumKey, type SpecificToolChoiceParam, type StreamOptionsParam, type SummaryTextContent, type SummaryTextContentTypeEnumKey, type SystemMessageItemParam, type SystemMessageItemParamRoleEnumKey, type SystemMessageItemParamTypeEnumKey, TekimaxClient, TekimaxResponse, type TextContent, type TextContentTypeEnumKey, type TextField, type TextFormatParam, type TextParam, type TextResponseFormat, type TextResponseFormatTypeEnumKey, type Tool, type ToolChoiceParam, type ToolChoiceValueEnum, type ToolChoiceValueEnumEnumKey, type TopLogProb, type TruncationEnum, type TruncationEnumEnumKey, type UrlCitationBody, type UrlCitationBodyTypeEnumKey, type UrlCitationParam, type UrlCitationParamTypeEnumKey, type Usage, type UserMessageItemParam, type UserMessageItemParamRoleEnumKey, type UserMessageItemParamTypeEnumKey, type VerbosityEnum, type VerbosityEnumEnumKey, allowedToolChoiceSchema, allowedToolChoiceTypeEnum, allowedToolsParamSchema, allowedToolsParamTypeEnum, annotationSchema, assistantMessageItemParamRoleEnum, assistantMessageItemParamSchema, assistantMessageItemParamTypeEnum, createResponseBodySchema, createresponse200Schema, createresponseMutationRequestSchema, createresponseMutationResponseSchema, detailEnumEnum, detailEnumSchema, developerMessageItemParamRoleEnum, developerMessageItemParamSchema, developerMessageItemParamTypeEnum, emptyModelParamSchema, errorPayloadSchema, errorSchema, errorStreamingEventSchema, errorStreamingEventTypeEnum, functionCallItemParamSchema, functionCallItemParamTypeEnum, functionCallItemStatusEnum, functionCallItemStatusSchema, functionCallOutputItemParamSchema, functionCallOutputItemParamTypeEnum, functionCallOutputSchema, functionCallOutputStatusEnumEnum, functionCallOutputStatusEnumSchema, functionCallOutputTypeEnum, functionCallSchema, functionCallStatusEnum, functionCallStatusSchema, functionCallTypeEnum, functionToolChoiceSchema, functionToolChoiceTypeEnum, functionToolParamSchema, functionToolParamTypeEnum, functionToolSchema, functionToolTypeEnum, imageDetailEnum, imageDetailSchema, includeEnumEnum, includeEnumSchema, incompleteDetailsSchema, inputFileContentParamSchema, inputFileContentParamTypeEnum, inputFileContentSchema, inputFileContentTypeEnum, inputImageContentParamAutoParamSchema, inputImageContentParamAutoParamTypeEnum, inputImageContentSchema, inputImageContentTypeEnum, inputTextContentParamSchema, inputTextContentParamTypeEnum, inputTextContentSchema, inputTextContentTypeEnum, inputTokensDetailsSchema, inputVideoContentSchema, inputVideoContentTypeEnum, itemFieldSchema, itemParamSchema, itemReferenceParamSchema, itemReferenceParamTypeEnum, jsonObjectResponseFormatSchema, jsonObjectResponseFormatTypeEnum, jsonSchemaResponseFormatParamSchema, jsonSchemaResponseFormatParamTypeEnum, jsonSchemaResponseFormatSchema, jsonSchemaResponseFormatTypeEnum, logProbSchema, messageRoleEnum, messageRoleSchema, messageSchema, messageStatusEnum, messageStatusSchema, messageTypeEnum, metadataParamSchema, outputTextContentParamSchema, outputTextContentParamTypeEnum, outputTextContentSchema, outputTextContentTypeEnum, outputTokensDetailsSchema, reasoningBodySchema, reasoningBodyTypeEnum, reasoningEffortEnumEnum, reasoningEffortEnumSchema, reasoningItemParamSchema, reasoningItemParamTypeEnum, reasoningParamSchema, reasoningSchema, reasoningSummaryContentParamSchema, reasoningSummaryContentParamTypeEnum, reasoningSummaryEnumEnum, reasoningSummaryEnumSchema, reasoningTextContentSchema, reasoningTextContentTypeEnum, refusalContentParamSchema, refusalContentParamTypeEnum, refusalContentSchema, refusalContentTypeEnum, responseCompletedStreamingEventSchema, responseCompletedStreamingEventTypeEnum, responseContentPartAddedStreamingEventSchema, responseContentPartAddedStreamingEventTypeEnum, responseContentPartDoneStreamingEventSchema, responseContentPartDoneStreamingEventTypeEnum, responseCreatedStreamingEventSchema, responseCreatedStreamingEventTypeEnum, responseFailedStreamingEventSchema, responseFailedStreamingEventTypeEnum, responseFunctionCallArgumentsDeltaStreamingEventSchema, responseFunctionCallArgumentsDeltaStreamingEventTypeEnum, responseFunctionCallArgumentsDoneStreamingEventSchema, responseFunctionCallArgumentsDoneStreamingEventTypeEnum, responseInProgressStreamingEventSchema, responseInProgressStreamingEventTypeEnum, responseIncompleteStreamingEventSchema, responseIncompleteStreamingEventTypeEnum, responseOutputItemAddedStreamingEventSchema, responseOutputItemAddedStreamingEventTypeEnum, responseOutputItemDoneStreamingEventSchema, responseOutputItemDoneStreamingEventTypeEnum, responseOutputTextAnnotationAddedStreamingEventSchema, responseOutputTextAnnotationAddedStreamingEventTypeEnum, responseOutputTextDeltaStreamingEventSchema, responseOutputTextDeltaStreamingEventTypeEnum, responseOutputTextDoneStreamingEventSchema, responseOutputTextDoneStreamingEventTypeEnum, responseQueuedStreamingEventSchema, responseQueuedStreamingEventTypeEnum, responseReasoningDeltaStreamingEventSchema, responseReasoningDeltaStreamingEventTypeEnum, responseReasoningDoneStreamingEventSchema, responseReasoningDoneStreamingEventTypeEnum, responseReasoningSummaryDeltaStreamingEventSchema, responseReasoningSummaryDeltaStreamingEventTypeEnum, responseReasoningSummaryDoneStreamingEventSchema, responseReasoningSummaryDoneStreamingEventTypeEnum, responseReasoningSummaryPartAddedStreamingEventSchema, responseReasoningSummaryPartAddedStreamingEventTypeEnum, responseReasoningSummaryPartDoneStreamingEventSchema, responseReasoningSummaryPartDoneStreamingEventTypeEnum, responseRefusalDeltaStreamingEventSchema, responseRefusalDeltaStreamingEventTypeEnum, responseRefusalDoneStreamingEventSchema, responseRefusalDoneStreamingEventTypeEnum, responseResourceObjectEnum, responseResourceSchema, responsesToolParamSchema, serviceTierEnumEnum, serviceTierEnumSchema, specificFunctionParamSchema, specificFunctionParamTypeEnum, specificToolChoiceParamSchema, streamOptionsParamSchema, summaryTextContentSchema, summaryTextContentTypeEnum, systemMessageItemParamRoleEnum, systemMessageItemParamSchema, systemMessageItemParamTypeEnum, textContentSchema, textContentTypeEnum, textFieldSchema, textFormatParamSchema, textParamSchema, textResponseFormatSchema, textResponseFormatTypeEnum, toolChoiceParamSchema, toolChoiceValueEnumEnum, toolChoiceValueEnumSchema, toolSchema, topLogProbSchema, truncationEnumEnum, truncationEnumSchema, urlCitationBodySchema, urlCitationBodyTypeEnum, urlCitationParamSchema, urlCitationParamTypeEnum, usageSchema, userMessageItemParamRoleEnum, userMessageItemParamSchema, userMessageItemParamTypeEnum, verbosityEnumEnum, verbosityEnumSchema };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
TekimaxClient: () => TekimaxClient,
|
|
24
|
+
TekimaxResponse: () => TekimaxResponse,
|
|
24
25
|
allowedToolChoiceSchema: () => allowedToolChoiceSchema,
|
|
25
26
|
allowedToolChoiceTypeEnum: () => allowedToolChoiceTypeEnum,
|
|
26
27
|
allowedToolsParamSchema: () => allowedToolsParamSchema,
|
|
@@ -1499,7 +1500,57 @@ var userMessageItemParamSchema = import_zod103.z.object({
|
|
|
1499
1500
|
});
|
|
1500
1501
|
|
|
1501
1502
|
// src/client.ts
|
|
1503
|
+
var TekimaxResponse = class {
|
|
1504
|
+
constructor(_raw) {
|
|
1505
|
+
this._raw = _raw;
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* Access the raw response object returned by the API.
|
|
1509
|
+
*/
|
|
1510
|
+
get raw() {
|
|
1511
|
+
return this._raw;
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Automatically extracts the text content from the response.
|
|
1515
|
+
* It looks for the first "output_text" item in the response content.
|
|
1516
|
+
*/
|
|
1517
|
+
get text() {
|
|
1518
|
+
if (!this._raw.output) return void 0;
|
|
1519
|
+
for (const item of this._raw.output) {
|
|
1520
|
+
if (item.type === "message") {
|
|
1521
|
+
for (const contentPart of item.content) {
|
|
1522
|
+
if (contentPart.type === "output_text" || contentPart.type === "text") {
|
|
1523
|
+
return contentPart.text;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
return void 0;
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* The ID of the response.
|
|
1532
|
+
*/
|
|
1533
|
+
get id() {
|
|
1534
|
+
return this._raw.id ?? void 0;
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* The model used to generate the response.
|
|
1538
|
+
*/
|
|
1539
|
+
get model() {
|
|
1540
|
+
return this._raw.model ?? void 0;
|
|
1541
|
+
}
|
|
1542
|
+
};
|
|
1502
1543
|
var TekimaxClient = class {
|
|
1544
|
+
/**
|
|
1545
|
+
* Creates a new TekimaxClient.
|
|
1546
|
+
*
|
|
1547
|
+
* @param options - Configuration options for the client.
|
|
1548
|
+
* @param options.baseUrl - The base URL of the API (default: "https://api.tekimax.com").
|
|
1549
|
+
* @param options.apiKey - Your Tekimax API key.
|
|
1550
|
+
*
|
|
1551
|
+
* @example
|
|
1552
|
+
* const client = new TekimaxClient({ apiKey: "tm_..." });
|
|
1553
|
+
*/
|
|
1503
1554
|
constructor(options = {}) {
|
|
1504
1555
|
this.baseUrl = options.baseUrl || "https://api.tekimax.com";
|
|
1505
1556
|
this.headers = {
|
|
@@ -1516,18 +1567,46 @@ var TekimaxClient = class {
|
|
|
1516
1567
|
if (!response.ok) {
|
|
1517
1568
|
throw new Error(`Tekimax API Error: ${response.status} ${response.statusText}`);
|
|
1518
1569
|
}
|
|
1519
|
-
|
|
1570
|
+
const data = await response.json();
|
|
1571
|
+
return new TekimaxResponse(data);
|
|
1520
1572
|
}
|
|
1521
|
-
|
|
1573
|
+
/**
|
|
1574
|
+
* Creates a new session and sends the initial message.
|
|
1575
|
+
*
|
|
1576
|
+
* @param message - The initial message text to start the session.
|
|
1577
|
+
* @param options - Additional configuration options (model, temperature, etc.).
|
|
1578
|
+
*
|
|
1579
|
+
* @example
|
|
1580
|
+
* const response = await client.createSession("Hello, world!", { model: "gpt-4" });
|
|
1581
|
+
* console.log(response.text);
|
|
1582
|
+
*/
|
|
1583
|
+
async createSession(message, options) {
|
|
1584
|
+
const body = {
|
|
1585
|
+
...options,
|
|
1586
|
+
input: message
|
|
1587
|
+
};
|
|
1522
1588
|
return this.request("/responses", body);
|
|
1523
1589
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1590
|
+
/**
|
|
1591
|
+
* Sends a message to an existing session or starts a new one if no previous_response_id is provided.
|
|
1592
|
+
*
|
|
1593
|
+
* @param message - The message text to send.
|
|
1594
|
+
* @param options - Additional configuration options.
|
|
1595
|
+
*
|
|
1596
|
+
* @example
|
|
1597
|
+
* const response = await client.sendMessage("What is the weather?", {
|
|
1598
|
+
* previous_response_id: "resp_123"
|
|
1599
|
+
* });
|
|
1600
|
+
* console.log(response.text);
|
|
1601
|
+
*/
|
|
1602
|
+
async sendMessage(message, options) {
|
|
1603
|
+
return this.createSession(message, options);
|
|
1526
1604
|
}
|
|
1527
1605
|
};
|
|
1528
1606
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1529
1607
|
0 && (module.exports = {
|
|
1530
1608
|
TekimaxClient,
|
|
1609
|
+
TekimaxResponse,
|
|
1531
1610
|
allowedToolChoiceSchema,
|
|
1532
1611
|
allowedToolChoiceTypeEnum,
|
|
1533
1612
|
allowedToolsParamSchema,
|
package/dist/index.mjs
CHANGED
|
@@ -1286,7 +1286,57 @@ var userMessageItemParamSchema = z103.object({
|
|
|
1286
1286
|
});
|
|
1287
1287
|
|
|
1288
1288
|
// src/client.ts
|
|
1289
|
+
var TekimaxResponse = class {
|
|
1290
|
+
constructor(_raw) {
|
|
1291
|
+
this._raw = _raw;
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Access the raw response object returned by the API.
|
|
1295
|
+
*/
|
|
1296
|
+
get raw() {
|
|
1297
|
+
return this._raw;
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Automatically extracts the text content from the response.
|
|
1301
|
+
* It looks for the first "output_text" item in the response content.
|
|
1302
|
+
*/
|
|
1303
|
+
get text() {
|
|
1304
|
+
if (!this._raw.output) return void 0;
|
|
1305
|
+
for (const item of this._raw.output) {
|
|
1306
|
+
if (item.type === "message") {
|
|
1307
|
+
for (const contentPart of item.content) {
|
|
1308
|
+
if (contentPart.type === "output_text" || contentPart.type === "text") {
|
|
1309
|
+
return contentPart.text;
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
return void 0;
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* The ID of the response.
|
|
1318
|
+
*/
|
|
1319
|
+
get id() {
|
|
1320
|
+
return this._raw.id ?? void 0;
|
|
1321
|
+
}
|
|
1322
|
+
/**
|
|
1323
|
+
* The model used to generate the response.
|
|
1324
|
+
*/
|
|
1325
|
+
get model() {
|
|
1326
|
+
return this._raw.model ?? void 0;
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1289
1329
|
var TekimaxClient = class {
|
|
1330
|
+
/**
|
|
1331
|
+
* Creates a new TekimaxClient.
|
|
1332
|
+
*
|
|
1333
|
+
* @param options - Configuration options for the client.
|
|
1334
|
+
* @param options.baseUrl - The base URL of the API (default: "https://api.tekimax.com").
|
|
1335
|
+
* @param options.apiKey - Your Tekimax API key.
|
|
1336
|
+
*
|
|
1337
|
+
* @example
|
|
1338
|
+
* const client = new TekimaxClient({ apiKey: "tm_..." });
|
|
1339
|
+
*/
|
|
1290
1340
|
constructor(options = {}) {
|
|
1291
1341
|
this.baseUrl = options.baseUrl || "https://api.tekimax.com";
|
|
1292
1342
|
this.headers = {
|
|
@@ -1303,17 +1353,45 @@ var TekimaxClient = class {
|
|
|
1303
1353
|
if (!response.ok) {
|
|
1304
1354
|
throw new Error(`Tekimax API Error: ${response.status} ${response.statusText}`);
|
|
1305
1355
|
}
|
|
1306
|
-
|
|
1356
|
+
const data = await response.json();
|
|
1357
|
+
return new TekimaxResponse(data);
|
|
1307
1358
|
}
|
|
1308
|
-
|
|
1359
|
+
/**
|
|
1360
|
+
* Creates a new session and sends the initial message.
|
|
1361
|
+
*
|
|
1362
|
+
* @param message - The initial message text to start the session.
|
|
1363
|
+
* @param options - Additional configuration options (model, temperature, etc.).
|
|
1364
|
+
*
|
|
1365
|
+
* @example
|
|
1366
|
+
* const response = await client.createSession("Hello, world!", { model: "gpt-4" });
|
|
1367
|
+
* console.log(response.text);
|
|
1368
|
+
*/
|
|
1369
|
+
async createSession(message, options) {
|
|
1370
|
+
const body = {
|
|
1371
|
+
...options,
|
|
1372
|
+
input: message
|
|
1373
|
+
};
|
|
1309
1374
|
return this.request("/responses", body);
|
|
1310
1375
|
}
|
|
1311
|
-
|
|
1312
|
-
|
|
1376
|
+
/**
|
|
1377
|
+
* Sends a message to an existing session or starts a new one if no previous_response_id is provided.
|
|
1378
|
+
*
|
|
1379
|
+
* @param message - The message text to send.
|
|
1380
|
+
* @param options - Additional configuration options.
|
|
1381
|
+
*
|
|
1382
|
+
* @example
|
|
1383
|
+
* const response = await client.sendMessage("What is the weather?", {
|
|
1384
|
+
* previous_response_id: "resp_123"
|
|
1385
|
+
* });
|
|
1386
|
+
* console.log(response.text);
|
|
1387
|
+
*/
|
|
1388
|
+
async sendMessage(message, options) {
|
|
1389
|
+
return this.createSession(message, options);
|
|
1313
1390
|
}
|
|
1314
1391
|
};
|
|
1315
1392
|
export {
|
|
1316
1393
|
TekimaxClient,
|
|
1394
|
+
TekimaxResponse,
|
|
1317
1395
|
allowedToolChoiceSchema,
|
|
1318
1396
|
allowedToolChoiceTypeEnum,
|
|
1319
1397
|
allowedToolsParamSchema,
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -1,9 +1,75 @@
|
|
|
1
|
-
import { CreateResponseBody, ResponseResource } from "./gen/types";
|
|
1
|
+
import { CreateResponseBody, ResponseResource, OutputTextContentParam } from "./gen/types";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A wrapper around the raw API response that provides helper methods
|
|
5
|
+
* for common tasks like extracting text content.
|
|
6
|
+
*/
|
|
7
|
+
export class TekimaxResponse {
|
|
8
|
+
constructor(private readonly _raw: ResponseResource) { }
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Access the raw response object returned by the API.
|
|
12
|
+
*/
|
|
13
|
+
get raw(): ResponseResource {
|
|
14
|
+
return this._raw;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Automatically extracts the text content from the response.
|
|
19
|
+
* It looks for the first "output_text" item in the response content.
|
|
20
|
+
*/
|
|
21
|
+
get text(): string | undefined {
|
|
22
|
+
if (!this._raw.output) return undefined;
|
|
23
|
+
|
|
24
|
+
for (const item of this._raw.output) {
|
|
25
|
+
if (item.type === "message") {
|
|
26
|
+
for (const contentPart of item.content) {
|
|
27
|
+
if (contentPart.type === "output_text" || contentPart.type === "text") {
|
|
28
|
+
return contentPart.text;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The ID of the response.
|
|
38
|
+
*/
|
|
39
|
+
get id(): string | undefined {
|
|
40
|
+
return this._raw.id ?? undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The model used to generate the response.
|
|
45
|
+
*/
|
|
46
|
+
get model(): string | undefined {
|
|
47
|
+
return this._raw.model ?? undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Options for sending a message or creating a session.
|
|
53
|
+
*/
|
|
54
|
+
export type MessageOptions = Omit<CreateResponseBody, "input" | "stream">;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The main client for interacting with the Tekimax API.
|
|
58
|
+
*/
|
|
3
59
|
export class TekimaxClient {
|
|
4
60
|
private baseUrl: string;
|
|
5
61
|
private headers: HeadersInit;
|
|
6
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Creates a new TekimaxClient.
|
|
65
|
+
*
|
|
66
|
+
* @param options - Configuration options for the client.
|
|
67
|
+
* @param options.baseUrl - The base URL of the API (default: "https://api.tekimax.com").
|
|
68
|
+
* @param options.apiKey - Your Tekimax API key.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* const client = new TekimaxClient({ apiKey: "tm_..." });
|
|
72
|
+
*/
|
|
7
73
|
constructor(options: { baseUrl?: string; apiKey?: string } = {}) {
|
|
8
74
|
this.baseUrl = options.baseUrl || "https://api.tekimax.com";
|
|
9
75
|
this.headers = {
|
|
@@ -12,7 +78,7 @@ export class TekimaxClient {
|
|
|
12
78
|
};
|
|
13
79
|
}
|
|
14
80
|
|
|
15
|
-
private async request
|
|
81
|
+
private async request(path: string, body: any): Promise<TekimaxResponse> {
|
|
16
82
|
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
17
83
|
method: "POST",
|
|
18
84
|
headers: this.headers,
|
|
@@ -23,14 +89,41 @@ export class TekimaxClient {
|
|
|
23
89
|
throw new Error(`Tekimax API Error: ${response.status} ${response.statusText}`);
|
|
24
90
|
}
|
|
25
91
|
|
|
26
|
-
|
|
92
|
+
const data = await response.json() as ResponseResource;
|
|
93
|
+
return new TekimaxResponse(data);
|
|
27
94
|
}
|
|
28
95
|
|
|
29
|
-
|
|
30
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Creates a new session and sends the initial message.
|
|
98
|
+
*
|
|
99
|
+
* @param message - The initial message text to start the session.
|
|
100
|
+
* @param options - Additional configuration options (model, temperature, etc.).
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* const response = await client.createSession("Hello, world!", { model: "gpt-4" });
|
|
104
|
+
* console.log(response.text);
|
|
105
|
+
*/
|
|
106
|
+
async createSession(message: string, options?: MessageOptions): Promise<TekimaxResponse> {
|
|
107
|
+
const body: CreateResponseBody = {
|
|
108
|
+
...options,
|
|
109
|
+
input: message,
|
|
110
|
+
};
|
|
111
|
+
return this.request("/responses", body);
|
|
31
112
|
}
|
|
32
113
|
|
|
33
|
-
|
|
34
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Sends a message to an existing session or starts a new one if no previous_response_id is provided.
|
|
116
|
+
*
|
|
117
|
+
* @param message - The message text to send.
|
|
118
|
+
* @param options - Additional configuration options.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* const response = await client.sendMessage("What is the weather?", {
|
|
122
|
+
* previous_response_id: "resp_123"
|
|
123
|
+
* });
|
|
124
|
+
* console.log(response.text);
|
|
125
|
+
*/
|
|
126
|
+
async sendMessage(message: string, options?: MessageOptions): Promise<TekimaxResponse> {
|
|
127
|
+
return this.createSession(message, options);
|
|
35
128
|
}
|
|
36
129
|
}
|
package/src/index.ts
CHANGED