File tree Expand file tree Collapse file tree 6 files changed +23
-14
lines changed
Expand file tree Collapse file tree 6 files changed +23
-14
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' token.js ' : minor
3+ ---
4+
5+ Minimize bundle size
Original file line number Diff line number Diff line change 33 "version" : " 0.2.3" ,
44 "description" : " Integrate 9 LLM providers with a single Typescript SDK using OpenAIs format." ,
55 "main" : " dist/index.cjs" ,
6- "module" : " dist/index.js" ,
76 "type" : " module" ,
8- "exports" : {
9- "." : {
10- "import" : " ./dist/index.js" ,
11- "require" : " ./dist/index.cjs" ,
12- "types" : " ./dist/index.d.ts"
13- }
14- },
157 "files" : [
168 " dist/*"
179 ],
Original file line number Diff line number Diff line change @@ -12,6 +12,16 @@ const build = async () => {
1212 platform : 'node' ,
1313 treeShaking : true ,
1414 tsconfig : 'tsconfig.json' ,
15+ external : [
16+ '@anthropic-ai/sdk' ,
17+ '@aws-sdk/client-bedrock-runtime' ,
18+ '@google/generative-ai' ,
19+ 'chalk' ,
20+ 'axios' ,
21+ 'cohere-ai' ,
22+ 'mime-types' ,
23+ 'openai' ,
24+ ] ,
1525 } ) ,
1626 ] )
1727}
Original file line number Diff line number Diff line change 11const dotenv = require ( 'dotenv' )
22
3- const { TokenJS } = require ( './dist/index.cjs' )
3+ const { TokenJS } = require ( '.. /dist/index.cjs' )
44
55dotenv . config ( )
66
Original file line number Diff line number Diff line change 11import * as dotenv from 'dotenv'
22import { OpenAI } from 'openai'
33
4- import { TokenJS } from '../src '
4+ import { TokenJS } from '../dist/index.cjs '
55dotenv . config ( )
66
77const messages : OpenAI . Chat . Completions . ChatCompletionMessageParam [ ] = [
@@ -15,15 +15,15 @@ const callLLM = async () => {
1515 const tokenjs = new TokenJS ( )
1616 const result = await tokenjs . chat . completions . create ( {
1717 // stream: true,
18- provider : 'openai ' ,
19- model : 'gpt-4o ' ,
18+ provider : 'gemini ' ,
19+ model : 'gemini-1.5-pro ' ,
2020 messages,
2121 } )
2222
2323 console . log ( result . choices )
2424
2525 // for await (const part of result) {
26- // process.stdout.write(part.choices[0]?.delta?.content || "");
26+ // process.stdout.write(part.choices[0]?.delta?.content || "");
2727 // }
2828}
2929
Original file line number Diff line number Diff line change 66 "sourceMap" : true ,
77 "esModuleInterop" : true ,
88 "composite" : true ,
9- "declaration" : true ,
109 "noImplicitAny" : false ,
1110 "removeComments" : true ,
1211 "noLib" : false ,
1918 "rootDir" : " ./src" ,
2019 "outDir" : " ./dist" ,
2120 "skipLibCheck" : true ,
21+ "declaration" : true ,
22+ "declarationDir" : " ./dist" ,
23+ "emitDeclarationOnly" : true
2224 },
2325 "exclude" : [
2426 " node_modules" ,
You can’t perform that action at this time.
0 commit comments