@fencyai/js 0.1.31 → 0.1.32

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.
@@ -1,4 +1,5 @@
1
- import { ChatCompletion, CreateChatCompletionRequest } from '../types.js';
1
+ import { ChatCompletion } from '../types/ChatCompletion';
2
+ import { CreateChatCompletionRequest } from '../types/CreateChatCompletionRequest';
2
3
  export interface CreateChatCompletionOptions {
3
4
  apiUrl?: string;
4
5
  request: CreateChatCompletionRequest;
@@ -1,4 +1,4 @@
1
- import { isChatCompletion, } from '../types.js';
1
+ import { isChatCompletion } from '../types/ChatCompletion';
2
2
  /**
3
3
  * Creates a chat completion by making a POST request to the Fency API.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { ChatCompletionStream } from '../types.js';
1
+ import { ChatCompletionStream } from '../types/ChatCompletionStream';
2
2
  /**
3
3
  * Creates a new stream by making a POST request to the Fency API.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { isChatCompletionStream } from '../types.js';
1
+ import { isChatCompletionStream, } from '../types/ChatCompletionStream';
2
2
  /**
3
3
  * Creates a new stream by making a POST request to the Fency API.
4
4
  *
package/lib/index.d.ts CHANGED
@@ -1,7 +1,17 @@
1
1
  import { createChatCompletion } from './api/createChatCompletion';
2
2
  import { createChatCompletionStream } from './api/createChatCompletionStream';
3
3
  import { loadFency } from './loadFency';
4
- export type { AnthropicModel, ChatCompletion, ChatCompletionMessage, ChatCompletionStream, CreateSynchronousChatCompletionParams, CreateChatCompletionRequest, FencyInstance, FencyOptions, GeminiModel, OpenAiModel, } from './types';
4
+ export type { FencyInstance, FencyOptions, } from './types';
5
+ export type { ChatCompletion, isChatCompletion } from './types/ChatCompletion';
6
+ export type { ChatCompletionMessage } from './types/ChatCompletionMessage';
7
+ export type { ChatCompletionStream } from './types/ChatCompletionStream';
8
+ export type { CreateChatCompletionRequest } from './types/CreateChatCompletionRequest';
9
+ export type { CreateAnthropicChatCompletionParams } from './types/CreateAnthropicChatCompletionParams';
10
+ export type { CreateGeminiChatCompletionParams } from './types/CreateGeminiChatCompletionParams';
11
+ export type { CreateOpenAiChatCompletionParams } from './types/CreateOpenAiChatCompletionParams';
12
+ export type { AnthropicModel } from './types/AnthropicModel';
13
+ export type { GeminiModel } from './types/GeminiModel';
14
+ export type { OpenAiModel } from './types/OpenAiModel';
5
15
  export { createChatCompletion } from './api/createChatCompletion';
6
16
  export type { CreateChatCompletionOptions } from './api/createChatCompletion';
7
17
  export { createChatCompletionStream } from './api/createChatCompletionStream';
@@ -0,0 +1 @@
1
+ export type AnthropicModel = 'claude-opus-4-0' | 'claude-sonnet-4-0';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export type ChatCompletion = {
2
+ id: string;
3
+ streamId?: string;
4
+ response?: string;
5
+ responseIsStructured?: boolean;
6
+ createdAt: string;
7
+ };
8
+ export declare const isChatCompletion: (data: any) => data is ChatCompletion;
@@ -0,0 +1,7 @@
1
+ export const isChatCompletion = (data) => {
2
+ return (typeof data === 'object' &&
3
+ data !== null &&
4
+ 'id' in data &&
5
+ 'createdAt' in data &&
6
+ data.type === 'ChatCompletion');
7
+ };
@@ -0,0 +1,4 @@
1
+ export type ChatCompletionMessage = {
2
+ role: 'user' | 'assistant' | 'system';
3
+ content: string;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface ChatCompletionStream {
2
+ id: string;
3
+ createdAt: string;
4
+ }
5
+ export declare const isChatCompletionStream: (data: any) => data is ChatCompletionStream;
@@ -0,0 +1,7 @@
1
+ export const isChatCompletionStream = (data) => {
2
+ return (typeof data === 'object' &&
3
+ data !== null &&
4
+ 'id' in data &&
5
+ 'createdAt' in data &&
6
+ data.type === 'ChatCompletionStream');
7
+ };
@@ -0,0 +1,6 @@
1
+ import { AnthropicModel } from '..';
2
+ import { ChatCompletionMessage } from './ChatCompletionMessage';
3
+ export type CreateAnthropicChatCompletionParams = {
4
+ model: AnthropicModel;
5
+ messages: Array<ChatCompletionMessage>;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { CreateAnthropicChatCompletionParams } from './CreateAnthropicChatCompletionParams';
2
+ import { CreateGeminiChatCompletionParams } from './CreateGeminiChatCompletionParams';
3
+ import { CreateOpenAiChatCompletionParams } from './CreateOpenAiChatCompletionParams';
4
+ export interface CreateChatCompletionRequest {
5
+ streamId?: string;
6
+ sessionClientSecret?: string;
7
+ openai?: CreateOpenAiChatCompletionParams;
8
+ gemini?: CreateGeminiChatCompletionParams;
9
+ anthropic?: CreateAnthropicChatCompletionParams;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { GeminiModel } from '..';
2
+ export type CreateGeminiChatCompletionParams = {
3
+ model: GeminiModel;
4
+ content: string;
5
+ responseJsonSchema?: string;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { ChatCompletionMessage } from './ChatCompletionMessage';
2
+ import { OpenAiModel } from './OpenAiModel';
3
+ export type CreateOpenAiChatCompletionParams = {
4
+ model: OpenAiModel;
5
+ messages: Array<ChatCompletionMessage>;
6
+ responseJsonSchema?: string;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type GeminiModel = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite-preview-06-17';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type OpenAiModel = 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'gpt-4o' | 'gpt-4o-mini';
@@ -0,0 +1 @@
1
+ export {};
package/lib/types.d.ts CHANGED
@@ -15,33 +15,3 @@ export interface FencyInstance {
15
15
  publishableKey: string;
16
16
  baseUrl: string;
17
17
  }
18
- export interface ChatCompletionStream {
19
- chatCompletionStreamId: string;
20
- }
21
- export type ChatCompletionMessage = {
22
- role: 'user' | 'assistant' | 'system';
23
- content: string;
24
- };
25
- export declare const isChatCompletionStream: (data: any) => data is ChatCompletionStream;
26
- export type OpenAiModel = 'gpt-4o' | 'gpt-4o-mini' | 'gpt-3.5-turbo';
27
- export type GeminiModel = 'gemini-1.5-flash' | 'gemini-2.0-flash';
28
- export type AnthropicModel = 'claude-3-5-sonnet' | 'claude-3-opus';
29
- export type CreateSynchronousChatCompletionParams<T extends OpenAiModel | GeminiModel | AnthropicModel> = {
30
- model: T;
31
- messages: Array<ChatCompletionMessage>;
32
- responseJsonSchema?: string;
33
- };
34
- export interface CreateChatCompletionRequest {
35
- chatCompletionStreamId?: string;
36
- openai?: CreateSynchronousChatCompletionParams<OpenAiModel>;
37
- gemini?: CreateSynchronousChatCompletionParams<GeminiModel>;
38
- anthropic?: CreateSynchronousChatCompletionParams<AnthropicModel>;
39
- }
40
- export type ChatCompletion = {
41
- chatCompletionId: string;
42
- chatCompletionStreamId?: string;
43
- response?: string;
44
- responseIsStructured?: boolean;
45
- createdAt: string;
46
- };
47
- export declare const isChatCompletion: (data: any) => data is ChatCompletion;
package/lib/types.js CHANGED
@@ -1,11 +1 @@
1
- export const isChatCompletionStream = (data) => {
2
- return (typeof data === 'object' &&
3
- data !== null &&
4
- 'chatCompletionStreamId' in data);
5
- };
6
- export const isChatCompletion = (data) => {
7
- return (typeof data === 'object' &&
8
- data !== null &&
9
- 'chatCompletionId' in data &&
10
- 'createdAt' in data);
11
- };
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fencyai/js",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "> TODO: description",
5
5
  "author": "staklau <steinaageklaussen@gmail.com>",
6
6
  "homepage": "",
@@ -39,5 +39,5 @@
39
39
  "ts-jest": "^29.1.1",
40
40
  "typescript": "^5.3.3"
41
41
  },
42
- "gitHead": "f39a452d0e2f90f06abc307f8aa04edbb7121680"
42
+ "gitHead": "a487d68673a259c2490b83a9a6fba991ea02d034"
43
43
  }