divi 0.0.1b0__tar.gz

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 (241) hide show
  1. divi-0.0.1b0/.dockerignore +1 -0
  2. divi-0.0.1b0/.github/dependabot.yml +11 -0
  3. divi-0.0.1b0/.gitignore +52 -0
  4. divi-0.0.1b0/LICENSE +21 -0
  5. divi-0.0.1b0/PKG-INFO +18 -0
  6. divi-0.0.1b0/README.md +14 -0
  7. divi-0.0.1b0/apps/README.md +15 -0
  8. divi-0.0.1b0/apps/docs/README.md +32 -0
  9. divi-0.0.1b0/apps/docs/docs.json +78 -0
  10. divi-0.0.1b0/apps/docs/en/concepts/score.mdx +4 -0
  11. divi-0.0.1b0/apps/docs/en/concepts/session.mdx +4 -0
  12. divi-0.0.1b0/apps/docs/en/development/roadmap.mdx +4 -0
  13. divi-0.0.1b0/apps/docs/en/introduction.mdx +15 -0
  14. divi-0.0.1b0/apps/docs/en/quickstart/trace.mdx +4 -0
  15. divi-0.0.1b0/apps/docs/en/tutorials/self-refine.mdx +4 -0
  16. divi-0.0.1b0/apps/docs/favicon.ico +0 -0
  17. divi-0.0.1b0/apps/docs/images/researcher-angel.png +0 -0
  18. divi-0.0.1b0/apps/docs/images/scholar-angel.png +0 -0
  19. divi-0.0.1b0/apps/docs/package.json +11 -0
  20. divi-0.0.1b0/apps/docs/snippets/snippet-intro.mdx +4 -0
  21. divi-0.0.1b0/apps/docs/zh/concepts/score.mdx +4 -0
  22. divi-0.0.1b0/apps/docs/zh/concepts/session.mdx +4 -0
  23. divi-0.0.1b0/apps/docs/zh/development/roadmap.mdx +4 -0
  24. divi-0.0.1b0/apps/docs/zh/introduction.mdx +15 -0
  25. divi-0.0.1b0/apps/docs/zh/quickstart/trace.mdx +4 -0
  26. divi-0.0.1b0/apps/docs/zh/tutorials/self-refine.mdx +4 -0
  27. divi-0.0.1b0/apps/graphql/Dockerfile +43 -0
  28. divi-0.0.1b0/apps/graphql/README.md +3 -0
  29. divi-0.0.1b0/apps/graphql/codegen.ts +19 -0
  30. divi-0.0.1b0/apps/graphql/package.json +28 -0
  31. divi-0.0.1b0/apps/graphql/src/datasources/auth-api.ts +76 -0
  32. divi-0.0.1b0/apps/graphql/src/datasources/datapark-api.ts +62 -0
  33. divi-0.0.1b0/apps/graphql/src/index.ts +34 -0
  34. divi-0.0.1b0/apps/graphql/src/resolvers.ts +125 -0
  35. divi-0.0.1b0/apps/graphql/src/schema.graphql +205 -0
  36. divi-0.0.1b0/apps/graphql/src/types/context.d.ts +9 -0
  37. divi-0.0.1b0/apps/graphql/src/types/response.d.ts +16 -0
  38. divi-0.0.1b0/apps/graphql/src/types/types.d.ts +658 -0
  39. divi-0.0.1b0/apps/graphql/tsconfig.json +13 -0
  40. divi-0.0.1b0/apps/web/.gitignore +36 -0
  41. divi-0.0.1b0/apps/web/README.md +36 -0
  42. divi-0.0.1b0/apps/web/app/dashboard/@modal/(.)traces/[id]/page.tsx +21 -0
  43. divi-0.0.1b0/apps/web/app/dashboard/@modal/default.tsx +3 -0
  44. divi-0.0.1b0/apps/web/app/dashboard/api-keys/actions.ts +131 -0
  45. divi-0.0.1b0/apps/web/app/dashboard/api-keys/components/columns.tsx +72 -0
  46. divi-0.0.1b0/apps/web/app/dashboard/api-keys/components/create-dialog.tsx +134 -0
  47. divi-0.0.1b0/apps/web/app/dashboard/api-keys/components/data-table-cell-viewer.tsx +108 -0
  48. divi-0.0.1b0/apps/web/app/dashboard/api-keys/components/data-table-toolbar.tsx +50 -0
  49. divi-0.0.1b0/apps/web/app/dashboard/api-keys/components/data-table.tsx +132 -0
  50. divi-0.0.1b0/apps/web/app/dashboard/api-keys/components/delete-dialog.tsx +70 -0
  51. divi-0.0.1b0/apps/web/app/dashboard/api-keys/data/data.tsx +10 -0
  52. divi-0.0.1b0/apps/web/app/dashboard/api-keys/data/schema.ts +11 -0
  53. divi-0.0.1b0/apps/web/app/dashboard/api-keys/layout.tsx +29 -0
  54. divi-0.0.1b0/apps/web/app/dashboard/api-keys/page.tsx +15 -0
  55. divi-0.0.1b0/apps/web/app/dashboard/components/app-sidebar.tsx +101 -0
  56. divi-0.0.1b0/apps/web/app/dashboard/components/nav-main.tsx +38 -0
  57. divi-0.0.1b0/apps/web/app/dashboard/components/nav-secondary.tsx +40 -0
  58. divi-0.0.1b0/apps/web/app/dashboard/components/nav-user.tsx +103 -0
  59. divi-0.0.1b0/apps/web/app/dashboard/components/site-header.tsx +24 -0
  60. divi-0.0.1b0/apps/web/app/dashboard/layout.tsx +56 -0
  61. divi-0.0.1b0/apps/web/app/dashboard/settings/account/components/account-form.tsx +86 -0
  62. divi-0.0.1b0/apps/web/app/dashboard/settings/account/page.tsx +63 -0
  63. divi-0.0.1b0/apps/web/app/dashboard/settings/appearance/components/appearance-form.tsx +47 -0
  64. divi-0.0.1b0/apps/web/app/dashboard/settings/appearance/page.tsx +18 -0
  65. divi-0.0.1b0/apps/web/app/dashboard/settings/components/profile-form.tsx +96 -0
  66. divi-0.0.1b0/apps/web/app/dashboard/settings/components/sidebar-nav.tsx +44 -0
  67. divi-0.0.1b0/apps/web/app/dashboard/settings/layout.tsx +48 -0
  68. divi-0.0.1b0/apps/web/app/dashboard/settings/page.tsx +23 -0
  69. divi-0.0.1b0/apps/web/app/dashboard/traces/(children)/[id]/components/Span.tsx +264 -0
  70. divi-0.0.1b0/apps/web/app/dashboard/traces/(children)/[id]/components/responsive-resizable.tsx +44 -0
  71. divi-0.0.1b0/apps/web/app/dashboard/traces/(children)/[id]/components/trace-board.tsx +38 -0
  72. divi-0.0.1b0/apps/web/app/dashboard/traces/(children)/[id]/components/trace-chart.tsx +120 -0
  73. divi-0.0.1b0/apps/web/app/dashboard/traces/(children)/[id]/page.tsx +13 -0
  74. divi-0.0.1b0/apps/web/app/dashboard/traces/(overview)/components/columns.tsx +100 -0
  75. divi-0.0.1b0/apps/web/app/dashboard/traces/(overview)/components/data-table-row-action.tsx +31 -0
  76. divi-0.0.1b0/apps/web/app/dashboard/traces/(overview)/components/data-table-toolbar.tsx +51 -0
  77. divi-0.0.1b0/apps/web/app/dashboard/traces/(overview)/components/data-table.tsx +132 -0
  78. divi-0.0.1b0/apps/web/app/dashboard/traces/(overview)/data/data.tsx +19 -0
  79. divi-0.0.1b0/apps/web/app/dashboard/traces/(overview)/data/schema.ts +12 -0
  80. divi-0.0.1b0/apps/web/app/dashboard/traces/(overview)/layout.tsx +26 -0
  81. divi-0.0.1b0/apps/web/app/dashboard/traces/(overview)/page.tsx +36 -0
  82. divi-0.0.1b0/apps/web/app/dashboard/usages/actions.ts +75 -0
  83. divi-0.0.1b0/apps/web/app/dashboard/usages/components/usage-board.tsx +74 -0
  84. divi-0.0.1b0/apps/web/app/dashboard/usages/components/usage-chart.tsx +205 -0
  85. divi-0.0.1b0/apps/web/app/dashboard/usages/layout.tsx +26 -0
  86. divi-0.0.1b0/apps/web/app/dashboard/usages/page.tsx +29 -0
  87. divi-0.0.1b0/apps/web/app/favicon.ico +0 -0
  88. divi-0.0.1b0/apps/web/app/home/components/home-header.tsx +52 -0
  89. divi-0.0.1b0/apps/web/app/home/components/home-hero.tsx +41 -0
  90. divi-0.0.1b0/apps/web/app/home/page.tsx +11 -0
  91. divi-0.0.1b0/apps/web/app/layout.tsx +43 -0
  92. divi-0.0.1b0/apps/web/app/login/components/login-form.tsx +71 -0
  93. divi-0.0.1b0/apps/web/app/login/page.tsx +44 -0
  94. divi-0.0.1b0/apps/web/app/page.tsx +5 -0
  95. divi-0.0.1b0/apps/web/app/signup/components/signup-form.tsx +52 -0
  96. divi-0.0.1b0/apps/web/app/signup/page.tsx +63 -0
  97. divi-0.0.1b0/apps/web/components/ApolloWrapper.tsx +40 -0
  98. divi-0.0.1b0/apps/web/components/Highter.tsx +19 -0
  99. divi-0.0.1b0/apps/web/components/Modal.tsx +117 -0
  100. divi-0.0.1b0/apps/web/components/calendar.tsx +84 -0
  101. divi-0.0.1b0/apps/web/components/data-table-column-header.tsx +102 -0
  102. divi-0.0.1b0/apps/web/components/data-table-faceted-filter.tsx +153 -0
  103. divi-0.0.1b0/apps/web/components/data-table-pagination.tsx +92 -0
  104. divi-0.0.1b0/apps/web/components/data-table-row.tsx +63 -0
  105. divi-0.0.1b0/apps/web/components/data-table-view-options.tsx +57 -0
  106. divi-0.0.1b0/apps/web/components/date-picker.tsx +101 -0
  107. divi-0.0.1b0/apps/web/components/mode-switcher.tsx +43 -0
  108. divi-0.0.1b0/apps/web/components/theme-provider.tsx +11 -0
  109. divi-0.0.1b0/apps/web/components.json +20 -0
  110. divi-0.0.1b0/apps/web/hooks/actionState.ts +29 -0
  111. divi-0.0.1b0/apps/web/hooks/apolloClient.ts +19 -0
  112. divi-0.0.1b0/apps/web/lib/callback/toast-callback.ts +25 -0
  113. divi-0.0.1b0/apps/web/lib/callback/with-callback.ts +29 -0
  114. divi-0.0.1b0/apps/web/lib/server/README.md +3 -0
  115. divi-0.0.1b0/apps/web/lib/server/auth.ts +23 -0
  116. divi-0.0.1b0/apps/web/lib/server/cookies.ts +32 -0
  117. divi-0.0.1b0/apps/web/lib/server/evaluation.ts +17 -0
  118. divi-0.0.1b0/apps/web/lib/server/openai.ts +49 -0
  119. divi-0.0.1b0/apps/web/lib/server/span.ts +148 -0
  120. divi-0.0.1b0/apps/web/lib/types/span.d.ts +27 -0
  121. divi-0.0.1b0/apps/web/lib/types/state.d.ts +8 -0
  122. divi-0.0.1b0/apps/web/lib/types/usage.d.ts +9 -0
  123. divi-0.0.1b0/apps/web/lib/utils.ts +35 -0
  124. divi-0.0.1b0/apps/web/middleware.ts +75 -0
  125. divi-0.0.1b0/apps/web/next-env.d.ts +5 -0
  126. divi-0.0.1b0/apps/web/next.config.ts +5 -0
  127. divi-0.0.1b0/apps/web/package.json +54 -0
  128. divi-0.0.1b0/apps/web/postcss.config.mjs +1 -0
  129. divi-0.0.1b0/apps/web/public/peeking-angel.png +0 -0
  130. divi-0.0.1b0/apps/web/public/thinking-angel.png +0 -0
  131. divi-0.0.1b0/apps/web/tsconfig.json +17 -0
  132. divi-0.0.1b0/apps/web/vercel.json +12 -0
  133. divi-0.0.1b0/biome.json +30 -0
  134. divi-0.0.1b0/compose-dev.yml +34 -0
  135. divi-0.0.1b0/divi/__init__.py +18 -0
  136. divi-0.0.1b0/divi/decorators/__init__.py +4 -0
  137. divi-0.0.1b0/divi/decorators/collect.py +34 -0
  138. divi-0.0.1b0/divi/decorators/obs_openai.py +48 -0
  139. divi-0.0.1b0/divi/decorators/observable.py +91 -0
  140. divi-0.0.1b0/divi/decorators/observe.py +47 -0
  141. divi-0.0.1b0/divi/evaluation/__init__.py +4 -0
  142. divi-0.0.1b0/divi/evaluation/evaluate.py +61 -0
  143. divi-0.0.1b0/divi/evaluation/evaluator.py +174 -0
  144. divi-0.0.1b0/divi/evaluation/prompts.py +19 -0
  145. divi-0.0.1b0/divi/evaluation/scores.py +8 -0
  146. divi-0.0.1b0/divi/proto/common/v1/common.proto +49 -0
  147. divi-0.0.1b0/divi/proto/common/v1/common_pb2.py +43 -0
  148. divi-0.0.1b0/divi/proto/common/v1/common_pb2.pyi +44 -0
  149. divi-0.0.1b0/divi/proto/core/health/v1/health_service.proto +17 -0
  150. divi-0.0.1b0/divi/proto/core/health/v1/health_service_pb2.py +41 -0
  151. divi-0.0.1b0/divi/proto/core/health/v1/health_service_pb2.pyi +19 -0
  152. divi-0.0.1b0/divi/proto/core/health/v1/health_service_pb2_grpc.py +100 -0
  153. divi-0.0.1b0/divi/proto/metric/v1/metric.proto +26 -0
  154. divi-0.0.1b0/divi/proto/metric/v1/metric_pb2.py +40 -0
  155. divi-0.0.1b0/divi/proto/metric/v1/metric_pb2.pyi +25 -0
  156. divi-0.0.1b0/divi/proto/trace/v1/trace.proto +50 -0
  157. divi-0.0.1b0/divi/proto/trace/v1/trace_pb2.py +42 -0
  158. divi-0.0.1b0/divi/proto/trace/v1/trace_pb2.pyi +42 -0
  159. divi-0.0.1b0/divi/services/__init__.py +7 -0
  160. divi-0.0.1b0/divi/services/auth/__init__.py +4 -0
  161. divi-0.0.1b0/divi/services/auth/auth.py +13 -0
  162. divi-0.0.1b0/divi/services/auth/init.py +22 -0
  163. divi-0.0.1b0/divi/services/auth/tokman.py +42 -0
  164. divi-0.0.1b0/divi/services/core/__init__.py +5 -0
  165. divi-0.0.1b0/divi/services/core/core.py +35 -0
  166. divi-0.0.1b0/divi/services/core/finish.py +15 -0
  167. divi-0.0.1b0/divi/services/core/init.py +70 -0
  168. divi-0.0.1b0/divi/services/datapark/__init__.py +4 -0
  169. divi-0.0.1b0/divi/services/datapark/datapark.py +91 -0
  170. divi-0.0.1b0/divi/services/datapark/init.py +21 -0
  171. divi-0.0.1b0/divi/services/finish.py +9 -0
  172. divi-0.0.1b0/divi/services/init.py +10 -0
  173. divi-0.0.1b0/divi/services/service.py +54 -0
  174. divi-0.0.1b0/divi/session/__init__.py +3 -0
  175. divi-0.0.1b0/divi/session/session.py +40 -0
  176. divi-0.0.1b0/divi/session/setup.py +48 -0
  177. divi-0.0.1b0/divi/session/teardown.py +7 -0
  178. divi-0.0.1b0/divi/signals/__init__.py +3 -0
  179. divi-0.0.1b0/divi/signals/span.py +83 -0
  180. divi-0.0.1b0/divi/signals/trace.py +79 -0
  181. divi-0.0.1b0/divi/utils.py +49 -0
  182. divi-0.0.1b0/docker-compose.yml +152 -0
  183. divi-0.0.1b0/docs/README.md +3 -0
  184. divi-0.0.1b0/docs/developer_tools.md +6 -0
  185. divi-0.0.1b0/docs/images/architecture.svg +2 -0
  186. divi-0.0.1b0/docs/images/favicon.ico +0 -0
  187. divi-0.0.1b0/docs/images/og-image.png +0 -0
  188. divi-0.0.1b0/docs/images/storage.svg +2 -0
  189. divi-0.0.1b0/docs/package_readme.md +5 -0
  190. divi-0.0.1b0/go.work +3 -0
  191. divi-0.0.1b0/go.work.sum +107 -0
  192. divi-0.0.1b0/hatch.toml +10 -0
  193. divi-0.0.1b0/package.json +24 -0
  194. divi-0.0.1b0/packages/README.md +15 -0
  195. divi-0.0.1b0/pnpm-lock.yaml +9913 -0
  196. divi-0.0.1b0/pnpm-workspace.yaml +21 -0
  197. divi-0.0.1b0/pyproject.toml +31 -0
  198. divi-0.0.1b0/scripts/README.md +3 -0
  199. divi-0.0.1b0/scripts/hatch_build.py +81 -0
  200. divi-0.0.1b0/scripts/image_build.py +112 -0
  201. divi-0.0.1b0/scripts/key_build.py +46 -0
  202. divi-0.0.1b0/scripts/proto_build.py +51 -0
  203. divi-0.0.1b0/services/README.md +17 -0
  204. divi-0.0.1b0/services/go.mod +75 -0
  205. divi-0.0.1b0/services/go.sum +253 -0
  206. divi-0.0.1b0/services/internal/app/auth/handler/api.go +8 -0
  207. divi-0.0.1b0/services/internal/app/auth/handler/api_key.go +128 -0
  208. divi-0.0.1b0/services/internal/app/auth/handler/auth.go +155 -0
  209. divi-0.0.1b0/services/internal/app/auth/handler/user.go +180 -0
  210. divi-0.0.1b0/services/internal/app/auth/router/router.go +39 -0
  211. divi-0.0.1b0/services/internal/app/core/.keep +0 -0
  212. divi-0.0.1b0/services/internal/app/datapark/handler/api.go +15 -0
  213. divi-0.0.1b0/services/internal/app/datapark/handler/evaluation.go +147 -0
  214. divi-0.0.1b0/services/internal/app/datapark/handler/metric.go +9 -0
  215. divi-0.0.1b0/services/internal/app/datapark/handler/openai.go +185 -0
  216. divi-0.0.1b0/services/internal/app/datapark/handler/session.go +43 -0
  217. divi-0.0.1b0/services/internal/app/datapark/handler/trace.go +311 -0
  218. divi-0.0.1b0/services/internal/app/datapark/handler/usage.go +127 -0
  219. divi-0.0.1b0/services/internal/app/datapark/router/router.go +54 -0
  220. divi-0.0.1b0/services/internal/pkg/auth/auth.go +37 -0
  221. divi-0.0.1b0/services/internal/pkg/auth/middleware.go +29 -0
  222. divi-0.0.1b0/services/internal/pkg/config/config.go +22 -0
  223. divi-0.0.1b0/services/internal/pkg/database/connect.go +73 -0
  224. divi-0.0.1b0/services/internal/pkg/database/database.go +16 -0
  225. divi-0.0.1b0/services/internal/pkg/model/api_key.go +27 -0
  226. divi-0.0.1b0/services/internal/pkg/model/openai.go +29 -0
  227. divi-0.0.1b0/services/internal/pkg/model/score.go +16 -0
  228. divi-0.0.1b0/services/internal/pkg/model/session.go +22 -0
  229. divi-0.0.1b0/services/internal/pkg/model/trace.go +48 -0
  230. divi-0.0.1b0/services/internal/pkg/model/usage.go +46 -0
  231. divi-0.0.1b0/services/internal/pkg/model/user.go +25 -0
  232. divi-0.0.1b0/services/pb/common.pb.go +455 -0
  233. divi-0.0.1b0/services/pb/health_service.pb.go +196 -0
  234. divi-0.0.1b0/services/pb/health_service_grpc.pb.go +125 -0
  235. divi-0.0.1b0/services/pb/metric.pb.go +222 -0
  236. divi-0.0.1b0/services/pb/trace.pb.go +327 -0
  237. divi-0.0.1b0/tests/__init__.py +1 -0
  238. divi-0.0.1b0/tests/unit_tests/decorators/test_obs_openai.py +153 -0
  239. divi-0.0.1b0/tests/unit_tests/decorators/test_observable.py +37 -0
  240. divi-0.0.1b0/turbo.json +39 -0
  241. divi-0.0.1b0/uv.lock +654 -0
@@ -0,0 +1 @@
1
+ node_modules
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: uv # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
@@ -0,0 +1,52 @@
1
+ .vscode/
2
+ .idea/
3
+
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+
9
+ # Distribution / packaging
10
+ .next/
11
+ dist/
12
+ out/
13
+ tmp/
14
+ build/
15
+ bin/
16
+
17
+ # Environments
18
+ .venv/
19
+ .env
20
+
21
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22
+
23
+ # Dependencies
24
+ node_modules
25
+ .pnp
26
+ .pnp.js
27
+
28
+ # Local env files
29
+ .env
30
+ .env.local
31
+ .env.development.local
32
+ .env.test.local
33
+ .env.production.local
34
+
35
+ # Testing
36
+ coverage
37
+
38
+ # Turbo
39
+ .turbo
40
+
41
+ # Vercel
42
+ .vercel
43
+
44
+ # Debug
45
+ npm-debug.log*
46
+ yarn-debug.log*
47
+ yarn-error.log*
48
+ .pytest_cache/
49
+
50
+ # Misc
51
+ .DS_Store
52
+ *.pem
divi-0.0.1b0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kaikai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
divi-0.0.1b0/PKG-INFO ADDED
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: divi
3
+ Version: 0.0.1b0
4
+ Summary: The Agent Platform for Observability & Evaluation
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: grpcio>=1.71.0
8
+ Requires-Dist: openai>=1.65.2
9
+ Requires-Dist: protobuf<6.0.dev0,>=5.26.1
10
+ Requires-Dist: pyjwt>=2.10.1
11
+ Requires-Dist: requests>=2.32.3
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Divine Agent
15
+
16
+ Agent Platform for Observability • Evaluation • Playground
17
+
18
+ > The project is still in the development stage. 😇
divi-0.0.1b0/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # divine-agent
2
+
3
+ **Agent Platform for Observability**
4
+
5
+ ## TODO
6
+
7
+ - [ ] Web
8
+ - [ ] Docs
9
+
10
+ ## Architecture
11
+
12
+ ![architecture](./docs/images/architecture.svg)
13
+
14
+ ![storage](./docs/images/storage.svg)
@@ -0,0 +1,15 @@
1
+ # Apps
2
+
3
+ > A series of web applications.
4
+
5
+ ## Table of Contents
6
+
7
+ | Name | Description | Port |
8
+ | --- | --- | --- |
9
+ | graphql | A GraphQL server | 4000 |
10
+ | web | A Next.js web server | 4001 |
11
+ | docs | A documentation server | 4002 |
12
+
13
+ ## Rules
14
+
15
+ 1. [Split project files by feature or route](https://nextjs.org/docs/app/getting-started/project-structure#split-project-files-by-feature-or-route)
@@ -0,0 +1,32 @@
1
+ # Mintlify Starter Kit
2
+
3
+ Click on `Use this template` to copy the Mintlify starter kit. The starter kit contains examples including
4
+
5
+ - Guide pages
6
+ - Navigation
7
+ - Customizations
8
+ - API Reference pages
9
+ - Use of popular components
10
+
11
+ ### Development
12
+
13
+ Install the [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview the documentation changes locally. To install, use the following command
14
+
15
+ ```
16
+ npm i -g mintlify
17
+ ```
18
+
19
+ Run the following command at the root of your documentation (where docs.json is)
20
+
21
+ ```
22
+ mintlify dev
23
+ ```
24
+
25
+ ### Publishing Changes
26
+
27
+ Install our Github App to auto propagate changes from your repo to your deployment. Changes will be deployed to production automatically after pushing to the default branch. Find the link to install on your dashboard.
28
+
29
+ #### Troubleshooting
30
+
31
+ - Mintlify dev isn't running - Run `mintlify install` it'll re-install dependencies.
32
+ - Page loads as a 404 - Make sure you are running in a folder with `docs.json`
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "https://mintlify.com/docs.json",
3
+ "theme": "maple",
4
+ "name": "Divine Agent",
5
+ "colors": {
6
+ "primary": "#09090b",
7
+ "light": "#FAFAFA",
8
+ "dark": "#09090b"
9
+ },
10
+ "favicon": "/favicon.ico",
11
+ "navigation": {
12
+ "languages": [
13
+ {
14
+ "language": "en",
15
+ "groups": [
16
+ {
17
+ "group": "Get Started",
18
+ "pages": ["en/introduction"]
19
+ },
20
+ {
21
+ "group": "Tutorials",
22
+ "pages": ["en/tutorials/self-refine"]
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "language": "zh",
28
+ "groups": [
29
+ {
30
+ "group": "快速开始",
31
+ "pages": ["zh/introduction"]
32
+ },
33
+ {
34
+ "group": "使用案例",
35
+ "pages": ["zh/tutorials/self-refine"]
36
+ }
37
+ ]
38
+ }
39
+ ],
40
+ "global": {
41
+ "anchors": [
42
+ {
43
+ "anchor": "Dashboard",
44
+ "href": "https://divine-agent.com",
45
+ "icon": "gauge-high"
46
+ }
47
+ ]
48
+ }
49
+ },
50
+ "logo": {
51
+ "light": "/images/researcher-angel.png",
52
+ "dark": "/images/scholar-angel.png"
53
+ },
54
+ "navbar": {
55
+ "links": [
56
+ {
57
+ "label": "GitHub",
58
+ "href": "https://github.com/Kaikaikaifang/divine-agent"
59
+ }
60
+ ],
61
+ "primary": {
62
+ "type": "button",
63
+ "label": "Divine Agent",
64
+ "href": "https://divine-agent.com"
65
+ }
66
+ },
67
+ "seo": {
68
+ "metatags": {
69
+ "og:image": "https://raw.githubusercontent.com/Kaikaikaifang/divine-agent/refs/heads/main/docs/images/og-image.png?token=GHSAT0AAAAAAC7SUUQIZIJIKDD5UWUKWX2CZ66TXVA"
70
+ },
71
+ "indexing": "navigable"
72
+ },
73
+ "footer": {
74
+ "socials": {
75
+ "github": "https://github.com/Kaikaikaifang/divine-agent"
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: 'Score'
3
+ description: 'Evaluate Scores'
4
+ ---
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: 'Session'
3
+ description: 'Session is a one-time run of your codes'
4
+ ---
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: 'Roadmap'
3
+ description: 'Development Roadmap for Divine Agent'
4
+ ---
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Introduction
3
+ description: "Welcome to the docs of Divine Agent"
4
+ ---
5
+
6
+ <img
7
+ className="block dark:hidden w-20"
8
+ src="/images/researcher-angel.png"
9
+ alt="Hero Light"
10
+ />
11
+ <img
12
+ className="hidden dark:block w-20"
13
+ src="/images/scholar-angel.png"
14
+ alt="Hero Dark"
15
+ />
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: 'Trace'
3
+ description: 'Start observe your agents in under 5 minutes'
4
+ ---
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: 'Self Refine'
3
+ description: 'Self-Refine for single agent'
4
+ ---
Binary file
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@app/docs",
3
+ "private": true,
4
+ "scripts": {
5
+ "dev": "mintlify dev --port 4002 --no-open",
6
+ "lint": "mintlify broken-links"
7
+ },
8
+ "devDependencies": {
9
+ "typescript": "catalog:"
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ One of the core principles of software development is DRY (Don't Repeat
2
+ Yourself). This is a principle that apply to documentation as
3
+ well. If you find yourself repeating the same content in multiple places, you
4
+ should consider creating a custom snippet to keep your content in sync.
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: '评分'
3
+ description: '评估评分'
4
+ ---
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: '会话'
3
+ description: 'Session is a one-time run of your codes'
4
+ ---
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: '开发路线图'
3
+ description: '开发路线图'
4
+ ---
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: '介绍'
3
+ description: "欢迎使用 Divine Agent"
4
+ ---
5
+
6
+ <img
7
+ className="block dark:hidden w-20"
8
+ src="/images/researcher-angel.png"
9
+ alt="Hero Light"
10
+ />
11
+ <img
12
+ className="hidden dark:block w-20"
13
+ src="/images/scholar-angel.png"
14
+ alt="Hero Dark"
15
+ />
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: '跟踪'
3
+ description: 'Start observe your agents in under 5 minutes'
4
+ ---
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: '自我反思'
3
+ description: '单智能体自我反思'
4
+ ---
@@ -0,0 +1,43 @@
1
+ FROM node:23-alpine AS base
2
+
3
+ FROM base AS builder
4
+ # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
5
+ RUN apk update
6
+ RUN apk add --no-cache libc6-compat
7
+ # 启用 corepack 并激活 pnpm
8
+ RUN corepack enable && corepack prepare pnpm@latest --activate
9
+ # Set working directory
10
+ WORKDIR /app
11
+ # 使用 yarn 全局安装 turbo
12
+ RUN yarn global add turbo
13
+ COPY . .
14
+ RUN turbo prune @app/graphql --docker
15
+
16
+ # Add lockfile and package.json's of isolated subworkspace
17
+ FROM base AS installer
18
+ RUN apk update
19
+ RUN apk add --no-cache libc6-compat
20
+ # 启用 corepack 并激活 pnpm
21
+ RUN corepack enable && corepack prepare pnpm@latest --activate
22
+ WORKDIR /app
23
+
24
+ # First install dependencies (as they change less often)
25
+ COPY --from=builder /app/out/json/ .
26
+ COPY --from=builder /app/out/pnpm-lock.yaml .
27
+ RUN pnpm install
28
+
29
+ # Build the project and its dependencies
30
+ COPY --from=builder /app/out/full/ .
31
+ RUN pnpm turbo build
32
+
33
+ FROM base AS runner
34
+ WORKDIR /app
35
+
36
+ # Don't run production as root
37
+ RUN addgroup --system --gid 1001 divi
38
+ RUN adduser --system --uid 1001 divi
39
+ USER divi
40
+ COPY --from=installer /app .
41
+
42
+ EXPOSE 4000
43
+ CMD ["node", "apps/graphql/dist/index.js"]
@@ -0,0 +1,3 @@
1
+ # Catstronauts - server
2
+
3
+ The starting point of the `server` code for Odyssey Lift-off I course.
@@ -0,0 +1,19 @@
1
+ import type { CodegenConfig } from '@graphql-codegen/cli';
2
+
3
+ const config: CodegenConfig = {
4
+ schema: './src/schema.graphql',
5
+ generates: {
6
+ './src/types/types.d.ts': {
7
+ plugins: ['typescript', 'typescript-resolvers'],
8
+ config: {
9
+ contextType: './context#DataSourceContext',
10
+ mappers: {
11
+ User: './user#UserModel',
12
+ APIKey: './api-key#APIKeyModel',
13
+ },
14
+ },
15
+ },
16
+ },
17
+ };
18
+
19
+ export default config;
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@app/graphql",
3
+ "private": true,
4
+ "main": "index.ts",
5
+ "scripts": {
6
+ "dev": "ts-node-dev --respawn ./src/index.ts",
7
+ "build": "tsc",
8
+ "start": "npm run build && nodemon ./dist/index.js",
9
+ "prebuild": "graphql-codegen",
10
+ "postbuild": "cp src/schema.graphql dist/"
11
+ },
12
+ "dependencies": {
13
+ "@apollo/datasource-rest": "^6.4.1",
14
+ "@apollo/server": "^4.12.0",
15
+ "@apollo/utils.keyvaluecache": "^3.1.0",
16
+ "graphql": "^16.11.0",
17
+ "graphql-tag": "^2.12.6"
18
+ },
19
+ "devDependencies": {
20
+ "@graphql-codegen/cli": "^4.0.1",
21
+ "@graphql-codegen/typescript": "^4.1.6",
22
+ "@graphql-codegen/typescript-resolvers": "^4.5.0",
23
+ "@workspace/typescript-config": "workspace:*",
24
+ "nodemon": "^3.1.10",
25
+ "ts-node-dev": "^2.0.0",
26
+ "typescript": "catalog:"
27
+ }
28
+ }
@@ -0,0 +1,76 @@
1
+ import type { FetchResponse } from '@/types/response';
2
+ import type { ApiKey, User } from '@/types/types';
3
+ import { type AugmentedRequest, RESTDataSource } from '@apollo/datasource-rest';
4
+ import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
5
+
6
+ export class AuthAPI extends RESTDataSource {
7
+ override baseURL = process.env.AUTH_SERVICE_URL ?? 'http://localhost:3000/';
8
+ private token: string;
9
+
10
+ constructor(options: { token: string; cache: KeyValueCache }) {
11
+ super(options);
12
+ this.token = options.token;
13
+ }
14
+
15
+ override willSendRequest(_path: string, request: AugmentedRequest) {
16
+ request.headers.authorization = this.token;
17
+ }
18
+
19
+ async createUser(email: string, password: string, username: string) {
20
+ return await this.post<FetchResponse<User>>('/api/user/', {
21
+ body: { email, password, username },
22
+ });
23
+ }
24
+
25
+ async getCurrentUser() {
26
+ return await this.get<FetchResponse<User>>('/api/user/');
27
+ }
28
+
29
+ async getUser(userId: string) {
30
+ return await this.get<FetchResponse<User>>(`/api/user/${userId}`);
31
+ }
32
+
33
+ async updateUser(userId: string, name: string | undefined) {
34
+ return await this.patch<FetchResponse<User>>(`/api/user/${userId}`, {
35
+ body: { name },
36
+ });
37
+ }
38
+
39
+ async deleteUser(userId: string, password: string) {
40
+ return await this.delete<FetchResponse<null>>(`/api/user/${userId}`, {
41
+ body: { password },
42
+ });
43
+ }
44
+
45
+ async getAPIKeys() {
46
+ return await this.get<FetchResponse<ApiKey[]>>('/api/api_key/');
47
+ }
48
+
49
+ async createAPIKey(name: string) {
50
+ return await this.post<FetchResponse<ApiKey>>('/api/api_key/', {
51
+ body: { name },
52
+ });
53
+ }
54
+
55
+ async updateAPIKey(apiKeyId: string, name: string | undefined) {
56
+ return await this.patch<FetchResponse<ApiKey>>(`/api/api_key/${apiKeyId}`, {
57
+ body: { name },
58
+ });
59
+ }
60
+
61
+ async revokeAPIKey(apiKeyId: string) {
62
+ return await this.delete<FetchResponse<null>>(`/api/api_key/${apiKeyId}`);
63
+ }
64
+
65
+ async login(identity: string, password: string) {
66
+ return await this.post<FetchResponse<string>>('/api/auth/login', {
67
+ body: { identity, password },
68
+ });
69
+ }
70
+
71
+ async loginWithAPIKey(apiKey: string) {
72
+ return await this.post<FetchResponse<string>>('/api/auth/api_key', {
73
+ body: { api_key: apiKey },
74
+ });
75
+ }
76
+ }
@@ -0,0 +1,62 @@
1
+ import type { FetchResponse } from '@/types/response';
2
+ import type { ChatInput, Score, Span, Trace, UsageResult } from '@/types/types';
3
+ import { type AugmentedRequest, RESTDataSource } from '@apollo/datasource-rest';
4
+ import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
5
+
6
+ export class DataParkAPI extends RESTDataSource {
7
+ override baseURL =
8
+ process.env.DATAPARK_SERVICE_URL ?? 'http://localhost:3001/';
9
+ private token: string;
10
+
11
+ constructor(options: { token: string; cache: KeyValueCache }) {
12
+ super(options);
13
+ this.token = options.token;
14
+ }
15
+
16
+ override willSendRequest(_path: string, request: AugmentedRequest) {
17
+ request.headers.authorization = this.token;
18
+ }
19
+
20
+ async getTraces(sessionId: string) {
21
+ return await this.get<FetchResponse<Trace[]>>(
22
+ `/api/session/${sessionId}/traces`
23
+ );
24
+ }
25
+
26
+ async getAllTraces() {
27
+ return await this.get<FetchResponse<Trace[]>>('/api/trace/');
28
+ }
29
+
30
+ async getSpans(traceId: string) {
31
+ return await this.get<FetchResponse<Span[]>>(`/api/trace/${traceId}/spans`);
32
+ }
33
+
34
+ async getScores(traceId: string) {
35
+ return await this.get<FetchResponse<Score[]>>(
36
+ `/api/trace/${traceId}/scores`
37
+ );
38
+ }
39
+
40
+ async getChatInput(spanId: string) {
41
+ return await this.get<FetchResponse<ChatInput>>(
42
+ `/api/v1/chat/completions/${spanId}/input`
43
+ );
44
+ }
45
+
46
+ async getCompletionUsage(
47
+ startTime: number,
48
+ endTime: number | undefined,
49
+ groupBy: string | undefined
50
+ ) {
51
+ return await this.get<FetchResponse<UsageResult[]>>(
52
+ '/api/usage/completions',
53
+ {
54
+ params: {
55
+ start_time: startTime.toString(),
56
+ end_time: endTime?.toString(),
57
+ group_by: groupBy,
58
+ },
59
+ }
60
+ );
61
+ }
62
+ }
@@ -0,0 +1,34 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { ApolloServer } from '@apollo/server';
4
+ import { startStandaloneServer } from '@apollo/server/standalone';
5
+ import gql from 'graphql-tag';
6
+ import { AuthAPI } from './datasources/auth-api';
7
+ import { DataParkAPI } from './datasources/datapark-api';
8
+ import { resolvers } from './resolvers';
9
+
10
+ const typeDefs = gql(
11
+ readFileSync(join(__dirname, './schema.graphql'), { encoding: 'utf-8' })
12
+ );
13
+
14
+ async function startApolloServer() {
15
+ const server = new ApolloServer({ typeDefs, resolvers });
16
+ const { url } = await startStandaloneServer(server, {
17
+ context: ({ req }) => {
18
+ const token = req.headers.authorization || '';
19
+ const { cache } = server;
20
+ return Promise.resolve({
21
+ dataSources: {
22
+ authAPI: new AuthAPI({ token, cache }),
23
+ dataparkAPI: new DataParkAPI({ token, cache }),
24
+ },
25
+ });
26
+ },
27
+ });
28
+ console.info(`
29
+ 🚀 Server is running!
30
+ 📭 Query at ${url}
31
+ `);
32
+ }
33
+
34
+ startApolloServer();