sonamu 0.7.12 → 0.7.14

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.
Files changed (64) hide show
  1. package/dist/api/config.d.ts +0 -3
  2. package/dist/api/config.d.ts.map +1 -1
  3. package/dist/api/config.js +1 -1
  4. package/dist/api/sonamu.d.ts.map +1 -1
  5. package/dist/api/sonamu.js +14 -4
  6. package/dist/bin/cli.js +2 -58
  7. package/dist/index.d.ts +0 -4
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +2 -7
  10. package/dist/syncer/api-parser.d.ts.map +1 -1
  11. package/dist/syncer/api-parser.js +3 -2
  12. package/dist/syncer/syncer.d.ts +2 -1
  13. package/dist/syncer/syncer.d.ts.map +1 -1
  14. package/dist/syncer/syncer.js +17 -18
  15. package/dist/types/types.d.ts +1 -1
  16. package/dist/ui/ai-api.d.ts +1 -0
  17. package/dist/ui/ai-api.d.ts.map +1 -0
  18. package/dist/ui/ai-api.js +50 -0
  19. package/dist/ui/ai-client.d.ts +1 -0
  20. package/dist/ui/ai-client.d.ts.map +1 -0
  21. package/dist/ui/ai-client.js +438 -0
  22. package/dist/ui/api.d.ts +3 -0
  23. package/dist/ui/api.d.ts.map +1 -0
  24. package/dist/ui/api.js +680 -0
  25. package/dist/ui-web/assets/brand-icons-Cu_C0hZ4.svg +1008 -0
  26. package/dist/ui-web/assets/brand-icons-F3SPCeH1.woff +0 -0
  27. package/dist/ui-web/assets/brand-icons-XL9sxUpA.woff2 +0 -0
  28. package/dist/ui-web/assets/brand-icons-sqJ2Pg7a.eot +0 -0
  29. package/dist/ui-web/assets/brand-icons-ubhWoxly.ttf +0 -0
  30. package/dist/ui-web/assets/flags-DOLqOU7Y.png +0 -0
  31. package/dist/ui-web/assets/icons-BOCtAERH.woff +0 -0
  32. package/dist/ui-web/assets/icons-CHzK1VD9.eot +0 -0
  33. package/dist/ui-web/assets/icons-D29ZQHHw.ttf +0 -0
  34. package/dist/ui-web/assets/icons-Du6TOHnR.woff2 +0 -0
  35. package/dist/ui-web/assets/icons-RwhydX30.svg +1518 -0
  36. package/dist/ui-web/assets/index-CpaB9P6g.css +1 -0
  37. package/dist/ui-web/assets/index-J9MCfjCd.js +95 -0
  38. package/dist/ui-web/assets/outline-icons-BfdLr8tr.svg +366 -0
  39. package/dist/ui-web/assets/outline-icons-DD8jm0uy.ttf +0 -0
  40. package/dist/ui-web/assets/outline-icons-DInHoiqI.woff2 +0 -0
  41. package/dist/ui-web/assets/outline-icons-LX8adJ4n.eot +0 -0
  42. package/dist/ui-web/assets/outline-icons-aQ88nltS.woff +0 -0
  43. package/dist/ui-web/assets/provider-utils_false-BKJD46kk.js +1 -0
  44. package/dist/ui-web/assets/provider-utils_false-Bu5lmX18.js +1 -0
  45. package/dist/ui-web/index.html +13 -0
  46. package/dist/ui-web/vite.svg +1 -0
  47. package/dist/vector/embedding.d.ts +2 -1
  48. package/dist/vector/embedding.d.ts.map +1 -1
  49. package/dist/vector/embedding.js +8 -8
  50. package/dist/vector/index.d.ts +5 -0
  51. package/dist/vector/index.d.ts.map +1 -0
  52. package/dist/vector/index.js +6 -0
  53. package/package.json +13 -7
  54. package/src/api/config.ts +0 -3
  55. package/src/api/sonamu.ts +17 -4
  56. package/src/bin/cli.ts +1 -67
  57. package/src/index.ts +0 -5
  58. package/src/syncer/api-parser.ts +2 -1
  59. package/src/syncer/syncer.ts +20 -21
  60. package/src/ui/ai-api.ts +60 -0
  61. package/src/ui/ai-client.ts +499 -0
  62. package/src/ui/api.ts +786 -0
  63. package/src/vector/embedding.ts +9 -7
  64. package/src/vector/index.ts +4 -0
@@ -1,6 +1,6 @@
1
- import { createOpenAI, type OpenAIProvider } from "@ai-sdk/openai";
1
+ import type { OpenAIProvider } from "@ai-sdk/openai";
2
2
  import { type EmbeddingModel, embedMany } from "ai";
3
- import { VoyageAIClient } from "voyageai";
3
+ import type { VoyageAIClient } from "voyageai";
4
4
  import { Sonamu } from "../api/sonamu";
5
5
  import { DEFAULT_VECTOR_CONFIG } from "./config";
6
6
  import type {
@@ -15,7 +15,7 @@ import type {
15
15
  * 임베딩 클라이언트
16
16
  * Voyage AI와 OpenAI 임베딩을 SDK 방식으로 통합 지원
17
17
  */
18
- export class EmbeddingClass {
18
+ class EmbeddingClass {
19
19
  private config: VectorConfig;
20
20
 
21
21
  constructor(config: Partial<VectorConfig> = {}) {
@@ -31,7 +31,8 @@ export class EmbeddingClass {
31
31
  /**
32
32
  * Voyage AI 클라이언트 초기화
33
33
  */
34
- private getVoyageClient(): VoyageAIClient {
34
+ private async getVoyageClient(): Promise<VoyageAIClient> {
35
+ const { VoyageAIClient } = await import("voyageai");
35
36
  const apiKey = Sonamu.secrets?.voyage_api_key ?? process.env.VOYAGE_API_KEY;
36
37
  if (!apiKey) {
37
38
  throw new Error("VOYAGE_API_KEY가 설정되지 않았습니다. 환경변수를 확인하세요.");
@@ -42,7 +43,8 @@ export class EmbeddingClass {
42
43
  /**
43
44
  * OpenAI provider 생성
44
45
  */
45
- private getOpenAIProvider(): OpenAIProvider {
46
+ private async getOpenAIProvider(): Promise<OpenAIProvider> {
47
+ const { createOpenAI } = await import("@ai-sdk/openai");
46
48
  const apiKey = Sonamu.secrets?.openai_api_key ?? process.env.OPENAI_API_KEY;
47
49
  if (!apiKey) {
48
50
  throw new Error("OPENAI_API_KEY가 설정되지 않았습니다. 환경변수를 확인하세요.");
@@ -107,7 +109,7 @@ export class EmbeddingClass {
107
109
  texts: string[],
108
110
  inputType: VectorInputType,
109
111
  ): Promise<EmbeddingResult[]> {
110
- const client = this.getVoyageClient();
112
+ const client = await this.getVoyageClient();
111
113
  const voyageConfig = this.config.voyage;
112
114
 
113
115
  const response = await client.embed({
@@ -130,7 +132,7 @@ export class EmbeddingClass {
130
132
  * OpenAI 임베딩
131
133
  */
132
134
  private async embedOpenAI(texts: string[]): Promise<EmbeddingResult[]> {
133
- const openai = this.getOpenAIProvider();
135
+ const openai = await this.getOpenAIProvider();
134
136
  const openaiConfig = this.config.openai;
135
137
  const model = openai.embeddingModel(openaiConfig.model);
136
138
 
@@ -0,0 +1,4 @@
1
+ export * from "./chunking";
2
+ export * from "./config";
3
+ export * from "./embedding";
4
+ export * from "./types";