@ax-llm/ax 9.0.5 → 9.0.7

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/CHANGELOG.md ADDED
@@ -0,0 +1,184 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ## 9.1.0 (2024-06-21)
6
+
7
+
8
+ ### Features
9
+
10
+ * add anthropic claude llms ([1e09f67](https://github.com/ax-llm/ax/commit/1e09f6720f34aa8025a37410df45c0cdedcfec49))
11
+ * add api rate-limiter support ([e4a8863](https://github.com/ax-llm/ax/commit/e4a8863e8fbbe3b7123737493bbb5c786eb51d96))
12
+ * add azure openai ([4478ed1](https://github.com/ax-llm/ax/commit/4478ed12c23abba3e935e84d37550a401f4562fb))
13
+ * add built-in function for embeddings ([37dfa99](https://github.com/ax-llm/ax/commit/37dfa99cb67eb36fabce79273727a3f201a3aa0b))
14
+ * add busines information extraction prompt ([cb2dca5](https://github.com/ax-llm/ax/commit/cb2dca5b34ffda2c0d03b45ac4c2c9d240615cc1))
15
+ * add caching proxy ([ba57bf9](https://github.com/ax-llm/ax/commit/ba57bf9417a74b719daa795afcd501235da1d3af))
16
+ * add caching proxy ([335dcbd](https://github.com/ax-llm/ax/commit/335dcbdbc4311784d095cc6be66b57d2a0d5909c))
17
+ * add google gemini safety controls ([7783bbe](https://github.com/ax-llm/ax/commit/7783bbee545d13a7b9f8a899d64ec2e59d1c931f))
18
+ * add google palm models ([cf6bf11](https://github.com/ax-llm/ax/commit/cf6bf11e30dee95d0799e6d19baa573a2a9765b9))
19
+ * add gpt-4 support ([405b87e](https://github.com/ax-llm/ax/commit/405b87e60fbb5942646e013c3a56fbc13d120c24))
20
+ * add ollama ([c1181e0](https://github.com/ax-llm/ax/commit/c1181e02e775f218a928dfdd0013d306c8e19106))
21
+ * add semantic router ([2096158](https://github.com/ax-llm/ax/commit/209615831a9f814bc10071280857d2b4f51c2a3a))
22
+ * add streaming support for gemini and cohere ([a946d52](https://github.com/ax-llm/ax/commit/a946d521f01267208ca863b0fd52b1f1d91d6929))
23
+ * add streaming support to proxy ([5edd33c](https://github.com/ax-llm/ax/commit/5edd33c1905a00a6fb1f05f395090e569ea954e5))
24
+ * add support for embeddings to use with vector search ([4bd4ba4](https://github.com/ax-llm/ax/commit/4bd4ba4cb9d3edd1dabea3ec8b3c3201b06b18da))
25
+ * add support for json type and other fixes ([3249746](https://github.com/ax-llm/ax/commit/32497461524b6138bf0c6142f71fe1d5b96386a2))
26
+ * add together compute llm api support ([37fc9cf](https://github.com/ax-llm/ax/commit/37fc9cf27e0b75e0068e7b58956b784ead6934cf))
27
+ * add vector db and embeddings example ([141ad9f](https://github.com/ax-llm/ax/commit/141ad9f1dd4d4f19c8ef07b362c57cb628f42e37))
28
+ * added a new llm alephalpha ([bff5f51](https://github.com/ax-llm/ax/commit/bff5f51812bcf22a8f6c89e58c98866208f14e1a))
29
+ * added agent tracing ([4bc9ae7](https://github.com/ax-llm/ax/commit/4bc9ae7ca5e02f194a23ed73b3aa8dcbbda43e4a))
30
+ * added claude3, gemini and fixed openai azure ([1c902d1](https://github.com/ax-llm/ax/commit/1c902d102fc8bce226c7c29bdafdb6e98b4ce170))
31
+ * added dsp ([fc9c292](https://github.com/ax-llm/ax/commit/fc9c292838fd7cdbb9e36633d7ad847206349c64))
32
+ * added in memory vector db with serialize to disk ([5036933](https://github.com/ax-llm/ax/commit/50369334388332ee9414b80b92835ab3915e786e))
33
+ * added mistral support ([67747a0](https://github.com/ax-llm/ax/commit/67747a0dd0840e429fda5c9c98f36fce125133e5))
34
+ * added more tests ([fe33451](https://github.com/ax-llm/ax/commit/fe33451711c9870144cafa8e242fa05fc3152f09))
35
+ * added multi-modal support to anthropic api and other fixes ([95a0680](https://github.com/ax-llm/ax/commit/95a0680ec61d8d9803c6cea0b2732abebf046461))
36
+ * added openai chat-gpt api support ([eb4b151](https://github.com/ax-llm/ax/commit/eb4b151c160bb33560c2072240e4770572b4f0ff))
37
+ * added prefix Ax across type namespace ([3a9daf0](https://github.com/ax-llm/ax/commit/3a9daf0e45de834fc7b8719c2908f1b90800e0e2))
38
+ * added proxy bin ([65adabe](https://github.com/ax-llm/ax/commit/65adabe6de137a886a3055d6f9ea32f2304635e1))
39
+ * added the dsp style bootstrap few stop optimizer ([eab69c8](https://github.com/ax-llm/ax/commit/eab69c811c510235fe28377c83db662b15489909))
40
+ * agent framework, agents can use other agents ([93cbfb3](https://github.com/ax-llm/ax/commit/93cbfb3912e13e7e353ae70311be4467a2c97568))
41
+ * agent framework, agents can use other agents ([a7420e7](https://github.com/ax-llm/ax/commit/a7420e7256bf12667449c96a35d84c1a0f66d2ef))
42
+ * ai balancer to pick the cheapest llm with automatic fallback ([a8f7b7b](https://github.com/ax-llm/ax/commit/a8f7b7b9772691056d94a5cfec4d94f064df4a8f))
43
+ * auto-fix json syntax errors ([dc27812](https://github.com/ax-llm/ax/commit/dc27812ec9c9521dcc38d526e23191e9466e7d4e))
44
+ * automatic long term memory ([e94ffd5](https://github.com/ax-llm/ax/commit/e94ffd50d910ff6b17c25e7131ee87c38b2eba56))
45
+ * automatic vectordb retrieval augmented generation in proxy ([d081c18](https://github.com/ax-llm/ax/commit/d081c189f4cb78a217f7cfeeb127f528153a8813))
46
+ * aws bedrock support ([acdc89b](https://github.com/ax-llm/ax/commit/acdc89b49c733b6a31bb5e17694c6abe28d324eb))
47
+ * big [breaking] refactor ([c97395d](https://github.com/ax-llm/ax/commit/c97395d6d7ea5e259151675c19b0cb2f21e0c2a2))
48
+ * convert any document format to text and a full RAG engine builtin ([7f3f28c](https://github.com/ax-llm/ax/commit/7f3f28c0c185506fc479bfd61c1f35588e65cfd6))
49
+ * dbmanager handles chunking, embedding and search for text ([5c125f8](https://github.com/ax-llm/ax/commit/5c125f87d54fba405407bc4085701ffbf4748a45))
50
+ * deepseek and cohere function calling ([5341700](https://github.com/ax-llm/ax/commit/5341700a39b80115e9bce50b0176a1c9760a6064))
51
+ * enable remote logging with LLMC_APIKEY env var ([e04b257](https://github.com/ax-llm/ax/commit/e04b25797676bced2ecdc10c7368983d54ca2e19))
52
+ * gpt-4o added ([a388219](https://github.com/ax-llm/ax/commit/a388219ec52cfcef132199453f55ecb7c489156e))
53
+ * huggingface data loader ([47c6c0e](https://github.com/ax-llm/ax/commit/47c6c0efcfa468466dc54af2c92cc970821d30e2))
54
+ * improve trace logging ([12776be](https://github.com/ax-llm/ax/commit/12776be18d2d4795a018ff3e2bf710288586b589))
55
+ * improved debug logs ([38e869e](https://github.com/ax-llm/ax/commit/38e869e1be07ca7a0193bbb908819bd6759b561a))
56
+ * include reasoning in tracing ([e11f665](https://github.com/ax-llm/ax/commit/e11f665626ab34f462c73e7e05dd74db7b27d1fd))
57
+ * iterate to completion if max token length reached ([f9d0f50](https://github.com/ax-llm/ax/commit/f9d0f508609355dd93090e0021b73693733f3a52))
58
+ * JS code interpreter function ([b3de309](https://github.com/ax-llm/ax/commit/b3de30939e1f1f91e59c851d2a9f9600ca4ebed9))
59
+ * library is now down to 1 single dependency ([efaaa03](https://github.com/ax-llm/ax/commit/efaaa0338dbd8d2e8f272c7965bf5afb999e4276))
60
+ * llm converts meeting notes to trello tasks example ([633cb95](https://github.com/ax-llm/ax/commit/633cb956e3c04cced5006d2b32198dd3b42e13db))
61
+ * lots of api improvements and many bug fixes ([036cd06](https://github.com/ax-llm/ax/commit/036cd0662b80b3ef8e5e4994d00746ac74024a0b))
62
+ * major refactor to enable traceing and usage tracking ([a7c980c](https://github.com/ax-llm/ax/commit/a7c980cb3f2e50ca1bd012c280a7bd8147978b91))
63
+ * make it easier to customize prompts ([1870ee7](https://github.com/ax-llm/ax/commit/1870ee77a0a3491a34570033197efeb87a6f632a))
64
+ * migrated from commonjs to ES2022 ([c8ad44b](https://github.com/ax-llm/ax/commit/c8ad44b6a61246602afb1c3307d46de6b13e8152))
65
+ * multi-modal dsp, use images in input fields ([a170b55](https://github.com/ax-llm/ax/commit/a170b555072baa13a2bc577248ae9d67f8c7db6f))
66
+ * new agent framework ([1e7040c](https://github.com/ax-llm/ax/commit/1e7040ce2049afa270efee5528ea5b954f66188e))
67
+ * new agent prompt ([6c4df2c](https://github.com/ax-llm/ax/commit/6c4df2c50d84adcfc2f18c42033ad82aa7ca6be6))
68
+ * new llm proxy for tracing usage ([ab36530](https://github.com/ax-llm/ax/commit/ab36530aca00510aa1fc339c38317897caa24064))
69
+ * new llmclient command and crawler to embed and vectorize websites ([47a61f2](https://github.com/ax-llm/ax/commit/47a61f25bd4aa84acc7e0c7e59f73e10338372cc))
70
+ * new llmclient command and crawler to embed and vectorize websites ([ede47c5](https://github.com/ax-llm/ax/commit/ede47c5b01fe17056a813fd44ad659186865f134))
71
+ * openapi wispher support ([50e864f](https://github.com/ax-llm/ax/commit/50e864f91806c2d723fe6edd46bc3a6a2ecd17d8))
72
+ * parsing and processing output fields and functions while streaming ([95a7a93](https://github.com/ax-llm/ax/commit/95a7a93b9c40f8e7b25a2dd14b3b43d84a8d50fc))
73
+ * proxy support for all llms ([1e1edc3](https://github.com/ax-llm/ax/commit/1e1edc3a6b61dedbb4b45af011c79974f9fdef1b))
74
+ * req tracing added to ai classes ([dad8c3c](https://github.com/ax-llm/ax/commit/dad8c3caa4f02d70364a3785d9349575b9c102b6))
75
+ * spider to embed website ([56f4598](https://github.com/ax-llm/ax/commit/56f45984f894a790f93819464e0dc0a91b4bc66f))
76
+ * streaming support ([65839a9](https://github.com/ax-llm/ax/commit/65839a9fc041853af10971474bb2f1417919d0d3))
77
+ * support for google vertex ([49ee383](https://github.com/ax-llm/ax/commit/49ee3833e5f2fc423ca8c059670157b20acc8ac6))
78
+ * support for Hugging Face and other updates ([8f64432](https://github.com/ax-llm/ax/commit/8f644328ab10fcd409b98b02807a96fdccbc79e7))
79
+ * support for remote tracing ([033a67a](https://github.com/ax-llm/ax/commit/033a67ab5f6e1f2778ec435fa0e6f181223b6728))
80
+ * track token usage ([bd4f798](https://github.com/ax-llm/ax/commit/bd4f79824a29a89fed60b38bcef28e2935cebb86))
81
+ * true realtime output validation while streaming ([4308b99](https://github.com/ax-llm/ax/commit/4308b99a8855595527fbd161920ae6968292650c))
82
+ * updates to agent framework api ([472efbf](https://github.com/ax-llm/ax/commit/472efbfcfe8f9718a1031263a0363a9a7f72f918))
83
+ * vector db query rewriting ([52fad9c](https://github.com/ax-llm/ax/commit/52fad9cea59c619fd5d9b74ae5139abbec9c4834))
84
+ * vector db query rewriting ([bce6d19](https://github.com/ax-llm/ax/commit/bce6d198c7f807f4e5a97b8e1211107fecaebb9a))
85
+ * vector db support ([0ea1c7f](https://github.com/ax-llm/ax/commit/0ea1c7f0963946ead1ffc0908a8c5c1be5ce00fd))
86
+ * welcome llm-client ([225ec5a](https://github.com/ax-llm/ax/commit/225ec5aa24cf422ed3018e6fd19e248a0a763391))
87
+
88
+
89
+ ### Bug Fixes
90
+
91
+ * add opentelemetry support and other fixes ([685fe80](https://github.com/ax-llm/ax/commit/685fe80f1687f97282f708d279e8588023e2213c))
92
+ * Add Polyfill for TextDecoderStream to Ensure Compatibility with Bun [#21](https://github.com/ax-llm/ax/issues/21) ([540348d](https://github.com/ax-llm/ax/commit/540348d9b25a361077b0e3574064fb4f2975b632))
93
+ * add tools support to anthropic ([1cc96b7](https://github.com/ax-llm/ax/commit/1cc96b7910127c9e00820b572b5fb6ca27662b1e))
94
+ * added missing typescript docs ([2459a28](https://github.com/ax-llm/ax/commit/2459a282e5cdd8ccc827665fe41f58974023bcfb))
95
+ * added system prompt to trace ([335bb40](https://github.com/ax-llm/ax/commit/335bb406eec22414014bcde8e264bb45bb44ff12))
96
+ * anthropic header issue ([40dbce0](https://github.com/ax-llm/ax/commit/40dbce0bd2ec03f1c9184e66cf88c8dfec31883c))
97
+ * anthropic proxy endpoint ([#7](https://github.com/ax-llm/ax/issues/7)) ([cf7c793](https://github.com/ax-llm/ax/commit/cf7c7939c393e85d63721762a6c7cc55c68502d2))
98
+ * anthropic, updated other models ([6e83d34](https://github.com/ax-llm/ax/commit/6e83d34f5acb8be282e172b47d9feeef0ce67436))
99
+ * Azure OpenAI chat/completion call failed ([#19](https://github.com/ax-llm/ax/issues/19)) ([#20](https://github.com/ax-llm/ax/issues/20)) ([0fad4f9](https://github.com/ax-llm/ax/commit/0fad4f9c3bd909c687b20193a5d0dbef4730481a))
100
+ * banner fixes ([fdf453b](https://github.com/ax-llm/ax/commit/fdf453b1ad02c337bcd0b8c213be3802a054eb9b))
101
+ * blank response with stream ([ab7c62d](https://github.com/ax-llm/ax/commit/ab7c62d52db231ae9661531f85a9d6a4cadfe222))
102
+ * bug in new open ai chat model ([654282d](https://github.com/ax-llm/ax/commit/654282d15c98d617840dc6f6014d0e961393bcd2))
103
+ * bug with exporting enums ([4fc0a3b](https://github.com/ax-llm/ax/commit/4fc0a3b5a7dd5413d8f6d4d3cfe18d2af54941c6))
104
+ * bug with exporting enums ([4ca8c5d](https://github.com/ax-llm/ax/commit/4ca8c5d23ec5b7320cc78936b3a663920ae6946c))
105
+ * build error ([e4d29c3](https://github.com/ax-llm/ax/commit/e4d29c34297c31bfe91def1af3468e6566554ce2))
106
+ * build fixes ([d8d4a47](https://github.com/ax-llm/ax/commit/d8d4a478e70ddfbff785d123f19ff78946f97789))
107
+ * build issue ([7733463](https://github.com/ax-llm/ax/commit/773346339acec1c7f7f9640cdf183b92fee28615))
108
+ * build issue ([071f476](https://github.com/ax-llm/ax/commit/071f476fe8046b561f54786e364517cf52fc91cb))
109
+ * build issue with previous version ([cfe92fd](https://github.com/ax-llm/ax/commit/cfe92fdbe5a2205815da3978a6c9903dcc46b617))
110
+ * build issues ([dd346c4](https://github.com/ax-llm/ax/commit/dd346c4b03aa43b2725ca3da40bab522ffb9297f))
111
+ * build issues ([33394df](https://github.com/ax-llm/ax/commit/33394dfd250e5c0f16bf9baa5c2b23d4d1777ef8))
112
+ * change name in package ([9697d19](https://github.com/ax-llm/ax/commit/9697d190526bfd923baa244aacd8e7522845a340))
113
+ * cleaup gitignore ([6627ff3](https://github.com/ax-llm/ax/commit/6627ff315aacddcfd321d014f7d129cd20142655))
114
+ * common llm model config to ensure more deterministic outputs ([0dce599](https://github.com/ax-llm/ax/commit/0dce59998bc731153a5d3588245e8fbfb7635727))
115
+ * examples ([973eb51](https://github.com/ax-llm/ax/commit/973eb51a23e0a6b4042d37b0e9967de2c0a76234))
116
+ * extra comma in package.json ([16b36f5](https://github.com/ax-llm/ax/commit/16b36f507e9b9e4cde6a823cb0f844f4ec0b3ee1))
117
+ * fix in proxy ([f778c9d](https://github.com/ax-llm/ax/commit/f778c9d2a8337730bc4ab08a0b00e304758d2500))
118
+ * fix in proxy ([f007d26](https://github.com/ax-llm/ax/commit/f007d269abd3768954d9e3428fe81e2ab2110b1c))
119
+ * fix in proxy ([ab87118](https://github.com/ax-llm/ax/commit/ab87118222de01ae4409aa5aaa65cdaa81eaf526))
120
+ * google gemini function calling ([a9214f3](https://github.com/ax-llm/ax/commit/a9214f3e6d2d96b724734e7a128276cbb76ca24d))
121
+ * google gemini now works great ([a6d6528](https://github.com/ax-llm/ax/commit/a6d6528e5f4a3a66be991ef8395159fb66bad1b8))
122
+ * import issues ([ce87294](https://github.com/ax-llm/ax/commit/ce87294cb62e293c6186a922b2a179bcde25baf1))
123
+ * improve examples ([6e656cb](https://github.com/ax-llm/ax/commit/6e656cbe631ff8eb127aae49e799a77cc55cecfb))
124
+ * improved the customer suppot example ([103b072](https://github.com/ax-llm/ax/commit/103b072c241140e380b0695d2c8fbaf5a91d3966))
125
+ * issue with cspell ([806cba1](https://github.com/ax-llm/ax/commit/806cba130fe61f96f8629d8d44344c80306c0611))
126
+ * issue with rate limiter ([0648ad7](https://github.com/ax-llm/ax/commit/0648ad7263493ebc34492cd72ec20704971c088f))
127
+ * json5 build issue ([fe6de9c](https://github.com/ax-llm/ax/commit/fe6de9ce995bc51996b12db57d9f3787bda2abd9))
128
+ * major fixes to function calling ([d44a373](https://github.com/ax-llm/ax/commit/d44a37300f4c427ede9a803939f5b90430e17a30))
129
+ * make mistral function calling work ([6bd9cf7](https://github.com/ax-llm/ax/commit/6bd9cf78b72ddd1b190ab798b47aedeb9a888001))
130
+ * make stop sequence optional ([d18addc](https://github.com/ax-llm/ax/commit/d18addcd287ce17dcd2a2c5feb8b8917d4f4f0e3))
131
+ * migrate npm package to llmclient ([97a4a07](https://github.com/ax-llm/ax/commit/97a4a07ed8e614563c7b7100141ce8bfde6aedb9))
132
+ * minor build fix ([32f04b3](https://github.com/ax-llm/ax/commit/32f04b3e5174a4915d8099c4a32c41979b0c652b))
133
+ * minor fix ([62fbf38](https://github.com/ax-llm/ax/commit/62fbf3807d60e1e367560a08ee40c25b9081137b))
134
+ * minor fixes ([3792700](https://github.com/ax-llm/ax/commit/3792700363172567b836cb5c562a62c41a703ce4))
135
+ * minor fixes ([574f73f](https://github.com/ax-llm/ax/commit/574f73f715f8972dbefa73e09978abf2de8e562c))
136
+ * minor fixes ([5ebf283](https://github.com/ax-llm/ax/commit/5ebf2831a8ecfef56df775ca127c546f0a562516))
137
+ * minor fixes ([5bb612d](https://github.com/ax-llm/ax/commit/5bb612d45a3089d8dac338a2cc8a21d388c161f9))
138
+ * minor fixes ([0fa4687](https://github.com/ax-llm/ax/commit/0fa4687ea70113321c829e9950e5b136da2e830d))
139
+ * minor fixes ([47eef31](https://github.com/ax-llm/ax/commit/47eef314ab5227940700938b08cfdbf39e390a7a))
140
+ * minor fixes ([0da9daf](https://github.com/ax-llm/ax/commit/0da9dafeb6375bdc819b1b0023253bf321f2ff07))
141
+ * minor fixes ([15bd72f](https://github.com/ax-llm/ax/commit/15bd72f9c8fff5b461792076f91e9689e7a55246))
142
+ * minor issue with incorrect error ([65e7ea8](https://github.com/ax-llm/ax/commit/65e7ea8847c98dc1d7ff72c6cb4e305936941330))
143
+ * missing imports ([9071c9e](https://github.com/ax-llm/ax/commit/9071c9e109921ef20d923f51a4d42ccfbb8bb5cd))
144
+ * new ai balancer to route based on token pricing in case of error ([7ea79a9](https://github.com/ax-llm/ax/commit/7ea79a90e0cf633d7517ce32701a9df18ba57b37))
145
+ * openai function tracing fixes ([d623f03](https://github.com/ax-llm/ax/commit/d623f03f6e8c3ad41fe5e919ef9433135bc199d9))
146
+ * opentelemetry tracing added to ai and vectordb ([1918410](https://github.com/ax-llm/ax/commit/1918410f4d83676fbcd9720b5707e5ab664761a6))
147
+ * prettier config ([8f4ca77](https://github.com/ax-llm/ax/commit/8f4ca77ecfe59605295e4f3f465db420e7380b9b))
148
+ * proxy command ([9eaf6e7](https://github.com/ax-llm/ax/commit/9eaf6e757422232135f21250300353735e4d6120))
149
+ * proxy port can be set using the env var PORT ([c08af8d](https://github.com/ax-llm/ax/commit/c08af8d3cac10d544794c618a8ddb6c19684ee7b))
150
+ * refactored request, response tracing ([1ac7023](https://github.com/ax-llm/ax/commit/1ac702334cd09dec9bc2f17944e67397762298ac))
151
+ * refactored usage reporting and other fixes ([84bf661](https://github.com/ax-llm/ax/commit/84bf661389ae806f2730bdd9d9edce2f5b932ede))
152
+ * remove comments ([73e3a30](https://github.com/ax-llm/ax/commit/73e3a3021d63e0b1fb2dcd6fc4b3e7a8267de4b1))
153
+ * remove index folder committed by mistake ([4d327ab](https://github.com/ax-llm/ax/commit/4d327abbbc7fb30041266f8cfdc426c7435c0a5f))
154
+ * removed crawler ([ab4ac6e](https://github.com/ax-llm/ax/commit/ab4ac6e10742611516067d937ab0350338973a3e))
155
+ * removed extra packages ([faae6d2](https://github.com/ax-llm/ax/commit/faae6d2512415cd8419105129a2a63527ec05371))
156
+ * renamed emailprompt to messageprompt ([3063a90](https://github.com/ax-llm/ax/commit/3063a907ed5383c63ed6f79cf1bcc27bf1fd04ac))
157
+ * renamed responseSchema to resultSchema for clarity ([b238b88](https://github.com/ax-llm/ax/commit/b238b88561cea813f3183d419b09b7f3386d16aa))
158
+ * resolved all typescript strict mode errors and warnings ([4f08fac](https://github.com/ax-llm/ax/commit/4f08face90d761faf97609213f88bbc84922d57c))
159
+ * result error-correction fixes ([eeaa12e](https://github.com/ax-llm/ax/commit/eeaa12e605f210df66c82a6f40e368d0ac6f0289))
160
+ * rewrite or error-correction code and other fixes ([37b620e](https://github.com/ax-llm/ax/commit/37b620e576982660d1013547043b07a1642b9892))
161
+ * seperated embed usage data from completion usage ([feb5619](https://github.com/ax-llm/ax/commit/feb5619f4df104e31edfbdd24f909a6c1b255a7f))
162
+ * set default model for openai to gpt3-turbo ([14ba73c](https://github.com/ax-llm/ax/commit/14ba73cc1fc80436c2073c85f5717215d03655a5))
163
+ * signature parser ([a149361](https://github.com/ax-llm/ax/commit/a149361263cae6e4bdc8a425f1abadd38ef9da56))
164
+ * streamlined the llm apis ([0bbc8b0](https://github.com/ax-llm/ax/commit/0bbc8b0729ef95657642ae3459fb43f5bbc666ff))
165
+ * system prompt fixes ([b56201c](https://github.com/ax-llm/ax/commit/b56201caf00df323925d2864f5c70f9ff70ee234))
166
+ * tests breaking ([4c047ce](https://github.com/ax-llm/ax/commit/4c047ce964d626129e0219e2dfef6ce7344f3747))
167
+ * ts cleanup ([be645d9](https://github.com/ax-llm/ax/commit/be645d952bec4d1b5022732a58a8705479147fbd))
168
+ * tuning and optimization fixes ([d0b892c](https://github.com/ax-llm/ax/commit/d0b892c7dd56f5720b75f8fe438cff8a5a29e535))
169
+ * type validation logic ([88eec1e](https://github.com/ax-llm/ax/commit/88eec1ebb4faa126ec491785c552a4958369f030))
170
+ * update model defaults ([1c70dd7](https://github.com/ax-llm/ax/commit/1c70dd7b2631f865216ae4d90c304db56880a806))
171
+ * update model defaults ([cc7e82f](https://github.com/ax-llm/ax/commit/cc7e82f0033f4881bc473dec53dc770023c32eab))
172
+ * update model defaults ([1251372](https://github.com/ax-llm/ax/commit/12513727f3b7f683858eed549f4ecea87883f91e))
173
+ * update package name ([ed5346c](https://github.com/ax-llm/ax/commit/ed5346c029e8228e37bae6494337496db5a4d774))
174
+ * Updated Cohere reqValue to include input_type (required since v3), Groq model to llama3-70b-8192 (llama2-70b-4096 was depreciated), and added a temporary fix to the marketing.py example (messageGuidelines expects a string, not a string array). ([#22](https://github.com/ax-llm/ax/issues/22)) ([5885877](https://github.com/ax-llm/ax/commit/5885877ecb2294566713abe323344c1b67eae9ba))
175
+ * updates to debugging proxy ([6476a23](https://github.com/ax-llm/ax/commit/6476a23a6b297f216b45afff12d1f37883714a92))
176
+ * valid healthcheck path for proxy ([3adea76](https://github.com/ax-llm/ax/commit/3adea76b081cc433450229c449f0c65bcb2a8cf7))
177
+ * various fixes ([a0099a8](https://github.com/ax-llm/ax/commit/a0099a8958fae739d431a82a8715cf86bc2e74b5))
178
+ * various fixes ([7b75342](https://github.com/ax-llm/ax/commit/7b753421b438d2f01ae20b0a25549c994bdd07b3))
179
+ * various fixes ([440cb84](https://github.com/ax-llm/ax/commit/440cb842a8c39f00b1ba7fbb6c4523a1d1275387))
180
+ * various fixes ([516fbcb](https://github.com/ax-llm/ax/commit/516fbcbf69f42d4a3d0a9169098087a0d603e945))
181
+ * various fixes ([0978b29](https://github.com/ax-llm/ax/commit/0978b2904454b1928f5254f1f241797f77a64ac2))
182
+ * various proxy fixes ([61b693a](https://github.com/ax-llm/ax/commit/61b693a9c95b4f173ca48bcc91b9154cfabc2963))
183
+ * version update ([c4794a3](https://github.com/ax-llm/ax/commit/c4794a3e1853c58b60f7e9357d755dab4bca6e4e))
184
+ * zprompt type spec ([db1f7e7](https://github.com/ax-llm/ax/commit/db1f7e75c4ac176ea3ca424e5fc276d5e43081be))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ax-llm/ax",
3
- "version": "9.0.5",
3
+ "version": "9.0.7",
4
4
  "type": "module",
5
5
  "description": "The best library to work with LLMs",
6
6
  "typings": "build/module/src/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "exports": "./build/module/src/index.js",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/dosco/ax.git"
11
+ "url": "https://github.com/ax-llm/ax.git"
12
12
  },
13
13
  "publishConfig": {
14
14
  "access": "public"
@@ -35,6 +35,7 @@
35
35
  "doc:publish": "gh-pages -m \"[ci skip] Updates\" -d docs",
36
36
  "version": "standard-version",
37
37
  "prepare": "run-s test",
38
+ "release": "npx git-cz && release-it --no-npm",
38
39
  "tsx": "node --env-file=.env --import=tsx"
39
40
  },
40
41
  "engines": {
@@ -44,9 +45,9 @@
44
45
  "json5": "^2.2.3"
45
46
  },
46
47
  "devDependencies": {
48
+ "@ava/typescript": "^5.0.0",
47
49
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
48
50
  "@total-typescript/tsconfig": "^1.0.4",
49
- "@types/lodash": "^4.17.0",
50
51
  "@types/node": "^20.11.30",
51
52
  "@types/readable-stream": "^4.0.11",
52
53
  "@types/stream-array": "^1.1.4",
@@ -66,11 +67,12 @@
66
67
  "gh-pages": "^6.1.1",
67
68
  "npm-run-all": "^4.1.5",
68
69
  "prettier": "^3.2.5",
70
+ "release-it": "^17.4.0",
69
71
  "standard-version": "^9.5.0",
70
72
  "ts-pegjs": "^4.2.1",
71
73
  "tsx": "^4.7.1",
72
- "typedoc": "^0.25.13",
73
- "typescript": "^5.6.0-dev.20240619"
74
+ "typedoc": "^0.26.0-beta.5",
75
+ "typescript": "^5.5.2"
74
76
  },
75
77
  "files": [
76
78
  "build/module",
@@ -1,8 +0,0 @@
1
- import type { ChatResponseFunctionCall } from '../ai/types.js';
2
- import type { AIServiceActionOptions, FunctionExec } from './types.js';
3
- export declare class FunctionProcessor {
4
- private funcList;
5
- constructor(funcList: readonly Function[]);
6
- private executeFunction;
7
- execute: (func: Readonly<ChatResponseFunctionCall>, options?: Readonly<AIServiceActionOptions>) => Promise<FunctionExec>;
8
- }
@@ -1,55 +0,0 @@
1
- import JSON5 from 'json5';
2
- import { validateJSONSchema } from './jsonschema.js';
3
- export class FunctionProcessor {
4
- funcList;
5
- constructor(funcList) {
6
- funcList
7
- .filter((v) => v.parameters)
8
- .forEach((v) => validateJSONSchema(v.parameters));
9
- this.funcList = funcList;
10
- }
11
- executeFunction = async (fnSpec, func, options) => {
12
- if (!fnSpec.func) {
13
- throw new Error(`Function handler for ${fnSpec.name} not implemented`);
14
- }
15
- let argOBj;
16
- if (func.args && func.args.length > 0) {
17
- argOBj = JSON5.parse(func.args);
18
- }
19
- if (!fnSpec.parameters) {
20
- const res = fnSpec.func.length === 1
21
- ? await fnSpec.func(options)
22
- : await fnSpec.func();
23
- return {
24
- name: fnSpec.name,
25
- result: JSON.stringify(res, null, 2)
26
- };
27
- }
28
- const res = fnSpec.func.length === 2
29
- ? await fnSpec.func(argOBj, options)
30
- : await fnSpec.func(argOBj);
31
- return {
32
- id: func.id,
33
- name: func.name,
34
- args: func.args,
35
- result: JSON.stringify(res, null, 2)
36
- };
37
- };
38
- execute = async (func, options) => {
39
- const fnSpec = this.funcList.find((v) => v.name.localeCompare(func.name) === 0);
40
- if (!fnSpec) {
41
- throw new Error(`Function not found: ` + func.name);
42
- }
43
- if (!fnSpec.func) {
44
- throw new Error('No handler for function: ' + func.name);
45
- }
46
- // execute value function calls
47
- const funcExec = await this.executeFunction(fnSpec, func, options);
48
- // // signal error if no data returned
49
- // if (!funcExec.result || funcExec.result.length === 0) {
50
- // funcExec.result = `No data returned by function`;
51
- // }
52
- return funcExec;
53
- };
54
- }
55
- //# sourceMappingURL=functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/text/functions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,OAAO,iBAAiB;IACpB,QAAQ,CAAsB;IAEtC,YAAY,QAA6B;QACvC,QAAQ;aACL,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;aAC3B,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAW,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEO,eAAe,GAAG,KAAK,EAC7B,MAA0B,EAC1B,IAAwC,EACxC,OAA0C,EACnB,EAAE;QACzB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,wBAAwB,MAAM,CAAC,IAAI,kBAAkB,CAAC,CAAC;QACzE,CAAC;QAED,IAAI,MAAM,CAAC;QACX,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACvB,MAAM,GAAG,GACP,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;gBACtB,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;gBAC5B,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAE1B,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;aACrC,CAAC;QACJ,CAAC;QAED,MAAM,GAAG,GACP,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;YACtB,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;YACpC,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhC,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;SACrC,CAAC;IACJ,CAAC,CAAC;IAEK,OAAO,GAAG,KAAK,EACpB,IAAwC,EACxC,OAA0C,EACnB,EAAE;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAC/B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAC7C,CAAC;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,sBAAsB,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3D,CAAC;QAED,+BAA+B;QAC/B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEnE,sCAAsC;QACtC,0DAA0D;QAC1D,sDAAsD;QACtD,IAAI;QACJ,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;CACH"}
@@ -1,3 +0,0 @@
1
- export * from './memory.js';
2
- export * from './types.js';
3
- export * from './functions.js';
@@ -1,4 +0,0 @@
1
- export * from './memory.js';
2
- export * from './types.js';
3
- export * from './functions.js';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/text/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
@@ -1 +0,0 @@
1
- export declare const validateJSONSchema: (schema: FunctionJSONSchema) => void;
@@ -1,96 +0,0 @@
1
- export const validateJSONSchema = (schema) => {
2
- const errors = [];
3
- const validateSchemaObject = (schema, path = '') => {
4
- const validTypes = [
5
- 'array',
6
- 'integer',
7
- 'number',
8
- 'string',
9
- 'boolean',
10
- 'null',
11
- 'object'
12
- ];
13
- if (!validTypes.includes(schema.type)) {
14
- errors.push(`Invalid type '${schema.type}' at ${path || 'root'}`);
15
- return;
16
- }
17
- if (schema.type === 'object' && schema.properties) {
18
- if (typeof schema.properties !== 'object' ||
19
- Array.isArray(schema.properties)) {
20
- errors.push(`Invalid properties object at ${path || 'root'}`);
21
- }
22
- else {
23
- for (const key in schema.properties) {
24
- const value = schema.properties[key];
25
- if (typeof value !== 'object') {
26
- errors.push(`Invalid schema object at ${path}${key}`);
27
- continue;
28
- }
29
- validateSchemaObject(value, `${path}${key}.`);
30
- }
31
- }
32
- if (schema.required && !Array.isArray(schema.required)) {
33
- errors.push(`'required' should be an array at ${path || 'root'}`);
34
- }
35
- }
36
- if (schema.type === 'array' && schema.items) {
37
- if (typeof schema.items !== 'object') {
38
- errors.push(`Invalid items schema at ${path || 'root'}`);
39
- }
40
- else {
41
- validateSchemaObject(schema.items, `${path}items.`);
42
- }
43
- }
44
- };
45
- validateSchemaObject(schema);
46
- if (errors.length > 0) {
47
- throw new Error(errors.join('; '));
48
- }
49
- };
50
- // Example Usage:
51
- /*
52
- const validSchema: FunctionJSONSchema = {
53
- type: 'object',
54
- properties: {
55
- id: { type: 'integer' },
56
- name: { type: 'string' },
57
- email: { type: 'string' },
58
- isActive: { type: 'boolean' },
59
- tags: {
60
- type: 'array',
61
- items: { type: 'string' }
62
- }
63
- },
64
- required: ['id', 'name', 'email']
65
- };
66
-
67
- const invalidSchema: any = {
68
- type: 'object',
69
- properties: {
70
- id: { type: 'integer' },
71
- name: { type: 'string' },
72
- email: { type: 'unknownType' }, // Invalid type
73
- isActive: { type: 'boolean' },
74
- tags: {
75
- type: 'array',
76
- items: { type: 'string' }
77
- }
78
- },
79
- required: 'id,name,email' // Invalid 'required' field
80
- };
81
-
82
- try {
83
- validateSchemaStructure(validSchema);
84
- console.log('Schema is valid!');
85
- } catch (error) {
86
- console.error('Schema validation failed:', error.message);
87
- }
88
-
89
- try {
90
- validateSchemaStructure(invalidSchema);
91
- console.log('Schema is valid!');
92
- } catch (error) {
93
- console.error('Schema validation failed:', error.message);
94
- }
95
- */
96
- //# sourceMappingURL=jsonschema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsonschema.js","sourceRoot":"","sources":["../../../../src/text/jsonschema.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAoC,EAC9B,EAAE;IACR,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,MAAM,oBAAoB,GAAG,CAC3B,MAAoC,EACpC,OAAe,EAAE,EACX,EAAE;QACR,MAAM,UAAU,GAAG;YACjB,OAAO;YACP,SAAS;YACT,QAAQ;YACR,QAAQ;YACR,SAAS;YACT,MAAM;YACN,QAAQ;SACT,CAAC;QAEF,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,iBAAiB,MAAM,CAAC,IAAI,QAAQ,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;YAClE,OAAO;QACT,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAClD,IACE,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ;gBACrC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAChC,CAAC;gBACD,MAAM,CAAC,IAAI,CAAC,gCAAgC,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;YAChE,CAAC;iBAAM,CAAC;gBACN,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;oBACpC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;oBACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;wBAC9B,MAAM,CAAC,IAAI,CAAC,4BAA4B,IAAI,GAAG,GAAG,EAAE,CAAC,CAAC;wBACtD,SAAS;oBACX,CAAC;oBACD,oBAAoB,CAAC,KAAK,EAAE,GAAG,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;YAED,IAAI,MAAM,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACvD,MAAM,CAAC,IAAI,CAAC,oCAAoC,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAC5C,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,2BAA2B,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;YAC3D,CAAC;iBAAM,CAAC;gBACN,oBAAoB,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,QAAQ,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAE7B,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC;AACH,CAAC,CAAC;AAEF,iBAAiB;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CE"}
@@ -1,21 +0,0 @@
1
- import type { ChatResponseResult } from '../ai/types.js';
2
- import type { ChatRequest } from '../types/index.js';
3
- import type { AIMemory } from './types.js';
4
- /**
5
- * A memory class to store ai interactions
6
- * @export
7
- */
8
- export declare class Memory implements AIMemory {
9
- private data;
10
- private sdata;
11
- private limit;
12
- constructor(limit?: number);
13
- add(value: Readonly<ChatRequest['chatPrompt'][0] | ChatRequest['chatPrompt']>, sessionId?: string): void;
14
- addResult({ content, name, functionCalls }: Readonly<ChatResponseResult>, sessionId?: string): void;
15
- updateResult({ content, name, functionCalls }: Readonly<ChatResponseResult>, sessionId?: string): void;
16
- history(sessionId?: string): ChatRequest['chatPrompt'];
17
- peek(sessionId?: string): ChatRequest['chatPrompt'];
18
- getLast(sessionId?: string): ChatRequest['chatPrompt'][0] | undefined;
19
- reset(sessionId?: string): void;
20
- private get;
21
- }
@@ -1,73 +0,0 @@
1
- /**
2
- * A memory class to store ai interactions
3
- * @export
4
- */
5
- export class Memory {
6
- data = [];
7
- sdata = new Map();
8
- limit;
9
- constructor(limit = 50) {
10
- if (limit <= 0) {
11
- throw Error("argument 'last' must be greater than 0");
12
- }
13
- this.limit = limit;
14
- }
15
- add(value, sessionId) {
16
- const d = this.get(sessionId);
17
- let n = 0;
18
- if (Array.isArray(value)) {
19
- n = d.push(...structuredClone(value));
20
- }
21
- else {
22
- n = d.push({
23
- ...structuredClone(value)
24
- });
25
- }
26
- if (d.length > this.limit) {
27
- d.splice(0, this.limit + n - this.limit);
28
- }
29
- }
30
- addResult({ content, name, functionCalls }, sessionId) {
31
- this.add({ content, name, role: 'assistant', functionCalls }, sessionId);
32
- }
33
- updateResult({ content, name, functionCalls }, sessionId) {
34
- const item = this.get(sessionId);
35
- if ('content' in item && content) {
36
- item.content = content;
37
- }
38
- if ('name' in item && name) {
39
- item.name = name;
40
- }
41
- if ('functionCalls' in item && functionCalls) {
42
- item.functionCalls = functionCalls;
43
- }
44
- }
45
- history(sessionId) {
46
- return this.get(sessionId);
47
- }
48
- peek(sessionId) {
49
- return this.get(sessionId);
50
- }
51
- getLast(sessionId) {
52
- const d = this.get(sessionId);
53
- return d.at(-1);
54
- }
55
- reset(sessionId) {
56
- if (!sessionId) {
57
- this.data = [];
58
- }
59
- else {
60
- this.sdata.set(sessionId, []);
61
- }
62
- }
63
- get(sessionId) {
64
- if (!sessionId) {
65
- return this.data;
66
- }
67
- if (!this.sdata.has(sessionId)) {
68
- this.sdata.set(sessionId, []);
69
- }
70
- return this.sdata.get(sessionId) || [];
71
- }
72
- }
73
- //# sourceMappingURL=memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../../src/text/memory.ts"],"names":[],"mappings":"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"}
@@ -1,57 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import type { ReadableStream } from 'stream/web';
4
- import type { ChatResponse, ChatResponseResult, EmbedResponse, ModelConfig, ModelInfo, RateLimiterFunction } from '../ai/types.js';
5
- import type { Tracer } from '../trace/index.js';
6
- import type { ChatRequest, EmbedRequest } from '../types/index.js';
7
- export type FunctionExec = {
8
- id?: string;
9
- name: string;
10
- args?: any;
11
- result?: string;
12
- };
13
- export type AIChatResponse<T> = {
14
- prompt: string;
15
- sessionId?: string;
16
- value(): T;
17
- };
18
- export interface AIMemory {
19
- add(result: Readonly<ChatRequest['chatPrompt'] | ChatRequest['chatPrompt'][0]>, sessionId?: string): void;
20
- addResult(result: Readonly<ChatResponseResult>, sessionId?: string): void;
21
- updateResult(result: Readonly<ChatResponseResult>, sessionId?: string): void;
22
- history(sessionId?: string): ChatRequest['chatPrompt'];
23
- peek(sessionId?: string): ChatRequest['chatPrompt'];
24
- reset(sessionId?: string): void;
25
- getLast(sessionId?: string): ChatRequest['chatPrompt'][0] | undefined;
26
- }
27
- export type AIPromptConfig = {
28
- stream?: boolean;
29
- };
30
- export type AITranscribeConfig = {
31
- language?: string;
32
- };
33
- export type AIServiceOptions = {
34
- debug?: boolean;
35
- rateLimiter?: RateLimiterFunction;
36
- fetch?: typeof fetch;
37
- tracer?: Tracer;
38
- };
39
- export type AIServiceActionOptions = {
40
- sessionId?: string;
41
- traceId?: string;
42
- };
43
- export interface AIService {
44
- getName(): string;
45
- getModelInfo(): Readonly<ModelInfo & {
46
- provider: string;
47
- }>;
48
- getEmbedModelInfo(): Readonly<ModelInfo> | undefined;
49
- getModelConfig(): Readonly<ModelConfig>;
50
- getFeatures(): {
51
- functions: boolean;
52
- streaming: boolean;
53
- };
54
- chat(req: Readonly<ChatRequest>, options?: Readonly<AIPromptConfig & AIServiceActionOptions>): Promise<ChatResponse | ReadableStream<ChatResponse>>;
55
- embed(req: Readonly<EmbedRequest>, options?: Readonly<AIServiceActionOptions & AIServiceActionOptions>): Promise<EmbedResponse>;
56
- setOptions(options: Readonly<AIServiceOptions>): void;
57
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/text/types.ts"],"names":[],"mappings":""}
@@ -1,51 +0,0 @@
1
- import type { AxFunctionJSONSchema, AxModelConfig, AxModelInfo } from '../ai/types.js';
2
- export type ParsingError = {
3
- message: string;
4
- value: string;
5
- };
6
- export type AxModelInfoWithProvider = AxModelInfo & {
7
- provider: string;
8
- };
9
- export type ChatRequest = {
10
- chatPrompt: Readonly<{
11
- role: 'system';
12
- content: string;
13
- } | {
14
- role: 'user';
15
- content: string;
16
- name?: string;
17
- } | {
18
- role: 'assistant';
19
- content: string | null;
20
- name?: string;
21
- functionCalls?: {
22
- id: string;
23
- type: 'function';
24
- function: {
25
- name: string;
26
- arguments?: string | object;
27
- };
28
- }[];
29
- } | {
30
- role: 'function';
31
- content: string;
32
- functionId: string;
33
- }>[];
34
- functions?: Readonly<{
35
- name: string;
36
- description: string;
37
- parameters?: AxFunctionJSONSchema;
38
- }>[];
39
- functionCall?: 'none' | 'auto' | 'required' | {
40
- type: 'function';
41
- function: {
42
- name: string;
43
- };
44
- };
45
- modelConfig?: Readonly<AxModelConfig>;
46
- modelInfo?: Readonly<AxModelInfoWithProvider>;
47
- };
48
- export type EmbedRequest = {
49
- texts?: readonly string[];
50
- embedModelInfo?: Readonly<AxModelInfoWithProvider>;
51
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":""}