ctod 0.6.1 → 0.6.2

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,4 @@
1
- import axios, { AxiosInstance } from 'axios'
1
+ import axios from 'axios'
2
2
  import { OpenAIVision } from './vision'
3
3
  import { OpenAIChat, Config } from './chat'
4
4
  import { OpenAIImagesGeneration } from './images-generation'
@@ -12,7 +12,7 @@ export class OpenAI {
12
12
  apiKey: string | (() => Promise<string>),
13
13
  config: Partial<Config> | (() => Promise<Partial<Config>>) = {},
14
14
  options?: {
15
- axios?: AxiosInstance
15
+ axios?: any
16
16
  }
17
17
  ) {
18
18
  return async(messages: any[], { onCancel }: any) => {
@@ -32,9 +32,9 @@ export class OpenAI {
32
32
  }
33
33
 
34
34
  static createChatRequestWithJsonSchema(params:{
35
- axios?: AxiosInstance,
35
+ axios?: any,
36
36
  apiKey: string | (() => Promise<string>),
37
- config?: Partial<Config> | (() => Promise<Partial<Config>>)
37
+ config?: Partial<Pick<Config, 'model' | 'temperature'>> | (() => Promise<Partial<Pick<Config, 'model' | 'temperature'>>>)
38
38
  }) {
39
39
  return async(messages: any[], { schema, onCancel }: any) => {
40
40
  const openai = new OpenAI(typeof params.apiKey === 'string' ? params.apiKey : await params.apiKey())
@@ -70,7 +70,7 @@ export class OpenAI {
70
70
  * @en If you need to set axios, please use this method.
71
71
  */
72
72
 
73
- setAxios(axios: AxiosInstance) {
73
+ setAxios(axios: any) {
74
74
  this._axios = axios
75
75
  }
76
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctod",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "CtoD Is Chat To Data Utils.",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -1,24 +1,23 @@
1
- import { AxiosInstance } from 'axios';
2
1
  import { OpenAIVision } from './vision';
3
2
  import { OpenAIChat, Config } from './chat';
4
3
  import { OpenAIImagesGeneration } from './images-generation';
5
4
  export declare class OpenAI {
6
- _axios: AxiosInstance;
5
+ _axios: import("axios").AxiosInstance;
7
6
  _apiKey: string;
8
7
  static createChatRequest(apiKey: string | (() => Promise<string>), config?: Partial<Config> | (() => Promise<Partial<Config>>), options?: {
9
- axios?: AxiosInstance;
8
+ axios?: any;
10
9
  }): (messages: any[], { onCancel }: any) => Promise<string>;
11
10
  static createChatRequestWithJsonSchema(params: {
12
- axios?: AxiosInstance;
11
+ axios?: any;
13
12
  apiKey: string | (() => Promise<string>);
14
- config?: Partial<Config> | (() => Promise<Partial<Config>>);
13
+ config?: Partial<Pick<Config, 'model' | 'temperature'>> | (() => Promise<Partial<Pick<Config, 'model' | 'temperature'>>>);
15
14
  }): (messages: any[], { schema, onCancel }: any) => Promise<string>;
16
15
  constructor(apiKey?: string);
17
16
  /**
18
17
  * @zh 如果你有需要特別設定 axios,請使用這方法。
19
18
  * @en If you need to set axios, please use this method.
20
19
  */
21
- setAxios(axios: AxiosInstance): void;
20
+ setAxios(axios: any): void;
22
21
  /**
23
22
  * @zh 設定 api key。
24
23
  * @en Set api key.