divi 0.0.1b1__tar.gz → 0.0.1b3__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 (263) hide show
  1. divi-0.0.1b3/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  2. divi-0.0.1b3/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  3. divi-0.0.1b3/.github/pull_request_template.md +12 -0
  4. {divi-0.0.1b1 → divi-0.0.1b3}/PKG-INFO +1 -1
  5. {divi-0.0.1b1 → divi-0.0.1b3}/README.md +6 -3
  6. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/docs.json +10 -2
  7. divi-0.0.1b3/apps/docs/en/quickstart/evaluation.mdx +34 -0
  8. divi-0.0.1b3/apps/docs/en/quickstart/trace.mdx +36 -0
  9. divi-0.0.1b3/apps/docs/images/pirate-eval-example-dark.png +0 -0
  10. divi-0.0.1b3/apps/docs/images/pirate-eval-example.png +0 -0
  11. divi-0.0.1b3/apps/docs/images/pirate-example-dark.png +0 -0
  12. divi-0.0.1b3/apps/docs/snippets/evaluation/pirate-custom-eval.mdx +40 -0
  13. divi-0.0.1b3/apps/docs/snippets/evaluation/pirate-eval.mdx +36 -0
  14. divi-0.0.1b3/apps/docs/snippets/pirate-example.mdx +34 -0
  15. divi-0.0.1b3/apps/docs/zh/quickstart/evaluation.mdx +34 -0
  16. divi-0.0.1b3/apps/docs/zh/quickstart/trace.mdx +36 -0
  17. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/components/create-dialog.tsx +1 -1
  18. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/layout.tsx +4 -3
  19. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/Modal.tsx +8 -2
  20. {divi-0.0.1b1 → divi-0.0.1b3}/divi/__init__.py +1 -1
  21. {divi-0.0.1b1 → divi-0.0.1b3}/divi/evaluation/evaluator.py +12 -3
  22. {divi-0.0.1b1 → divi-0.0.1b3}/divi/evaluation/prompts.py +1 -1
  23. {divi-0.0.1b1 → divi-0.0.1b3}/divi/signals/span.py +5 -0
  24. {divi-0.0.1b1 → divi-0.0.1b3}/divi/signals/trace.py +5 -0
  25. divi-0.0.1b3/docs/CODE_OF_CONDUCT.md +128 -0
  26. divi-0.0.1b3/docs/CONTRIBUTING.md +3 -0
  27. divi-0.0.1b3/docs/README_ZH.md +77 -0
  28. divi-0.0.1b3/docs/SECURITY.md +16 -0
  29. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/datapark/handler/evaluation.go +0 -17
  30. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/datapark/handler/openai.go +0 -18
  31. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/datapark/handler/trace.go +0 -22
  32. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/database/connect.go +1 -1
  33. divi-0.0.1b3/services/internal/pkg/database/create.go +75 -0
  34. divi-0.0.1b1/apps/docs/en/quickstart/evaluation.mdx +0 -5
  35. divi-0.0.1b1/apps/docs/en/quickstart/trace.mdx +0 -56
  36. divi-0.0.1b1/apps/docs/zh/quickstart/trace.mdx +0 -56
  37. divi-0.0.1b1/docs/README.md +0 -3
  38. {divi-0.0.1b1 → divi-0.0.1b3}/.dockerignore +0 -0
  39. {divi-0.0.1b1 → divi-0.0.1b3}/.github/dependabot.yml +0 -0
  40. {divi-0.0.1b1 → divi-0.0.1b3}/.gitignore +0 -0
  41. {divi-0.0.1b1 → divi-0.0.1b3}/LICENSE +0 -0
  42. {divi-0.0.1b1 → divi-0.0.1b3}/apps/README.md +0 -0
  43. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/README.md +0 -0
  44. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/en/concepts/score.mdx +0 -0
  45. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/en/concepts/session.mdx +0 -0
  46. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/en/development/roadmap.mdx +0 -0
  47. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/en/introduction.mdx +0 -0
  48. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/en/tutorials/self-refine.mdx +0 -0
  49. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/favicon.ico +0 -0
  50. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/images/pirate-example.png +0 -0
  51. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/images/researcher-angel.png +0 -0
  52. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/images/scholar-angel.png +0 -0
  53. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/package.json +0 -0
  54. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/snippets/snippet-intro.mdx +0 -0
  55. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/zh/concepts/score.mdx +0 -0
  56. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/zh/concepts/session.mdx +0 -0
  57. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/zh/development/roadmap.mdx +0 -0
  58. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/zh/introduction.mdx +0 -0
  59. {divi-0.0.1b1 → divi-0.0.1b3}/apps/docs/zh/tutorials/self-refine.mdx +0 -0
  60. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/Dockerfile +0 -0
  61. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/README.md +0 -0
  62. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/codegen.ts +0 -0
  63. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/package.json +0 -0
  64. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/src/datasources/auth-api.ts +0 -0
  65. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/src/datasources/datapark-api.ts +0 -0
  66. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/src/index.ts +0 -0
  67. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/src/resolvers.ts +0 -0
  68. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/src/schema.graphql +0 -0
  69. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/src/types/context.d.ts +0 -0
  70. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/src/types/response.d.ts +0 -0
  71. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/src/types/types.d.ts +0 -0
  72. {divi-0.0.1b1 → divi-0.0.1b3}/apps/graphql/tsconfig.json +0 -0
  73. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/.gitignore +0 -0
  74. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/README.md +0 -0
  75. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/@modal/(.)traces/[id]/page.tsx +1 -1
  76. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/@modal/default.tsx +0 -0
  77. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/actions.ts +0 -0
  78. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/components/columns.tsx +0 -0
  79. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/components/data-table-cell-viewer.tsx +0 -0
  80. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/components/data-table-toolbar.tsx +0 -0
  81. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/components/data-table.tsx +0 -0
  82. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/components/delete-dialog.tsx +0 -0
  83. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/data/data.tsx +0 -0
  84. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/data/schema.ts +0 -0
  85. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/layout.tsx +0 -0
  86. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/api-keys/page.tsx +0 -0
  87. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/components/app-sidebar.tsx +0 -0
  88. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/components/nav-main.tsx +0 -0
  89. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/components/nav-secondary.tsx +0 -0
  90. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/components/nav-user.tsx +0 -0
  91. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/components/site-header.tsx +0 -0
  92. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/settings/account/components/account-form.tsx +0 -0
  93. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/settings/account/page.tsx +0 -0
  94. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/settings/appearance/components/appearance-form.tsx +0 -0
  95. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/settings/appearance/page.tsx +0 -0
  96. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/settings/components/profile-form.tsx +0 -0
  97. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/settings/components/sidebar-nav.tsx +0 -0
  98. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/settings/layout.tsx +0 -0
  99. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/settings/page.tsx +0 -0
  100. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(children)/[id]/components/Span.tsx +0 -0
  101. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(children)/[id]/components/responsive-resizable.tsx +0 -0
  102. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(children)/[id]/components/trace-board.tsx +0 -0
  103. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(children)/[id]/components/trace-chart.tsx +0 -0
  104. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(children)/[id]/page.tsx +0 -0
  105. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(overview)/components/columns.tsx +0 -0
  106. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(overview)/components/data-table-row-action.tsx +0 -0
  107. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(overview)/components/data-table-toolbar.tsx +0 -0
  108. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(overview)/components/data-table.tsx +0 -0
  109. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(overview)/data/data.tsx +0 -0
  110. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(overview)/data/schema.ts +0 -0
  111. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(overview)/layout.tsx +0 -0
  112. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/traces/(overview)/page.tsx +0 -0
  113. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/usages/actions.ts +0 -0
  114. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/usages/components/usage-board.tsx +0 -0
  115. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/usages/components/usage-chart.tsx +0 -0
  116. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/usages/layout.tsx +0 -0
  117. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/dashboard/usages/page.tsx +0 -0
  118. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/favicon.ico +0 -0
  119. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/home/components/home-header.tsx +0 -0
  120. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/home/components/home-hero.tsx +0 -0
  121. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/home/page.tsx +0 -0
  122. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/layout.tsx +0 -0
  123. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/login/components/login-form.tsx +0 -0
  124. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/login/page.tsx +0 -0
  125. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/page.tsx +0 -0
  126. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/signup/components/signup-form.tsx +0 -0
  127. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/app/signup/page.tsx +0 -0
  128. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/ApolloWrapper.tsx +0 -0
  129. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/Highter.tsx +0 -0
  130. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/calendar.tsx +0 -0
  131. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/data-table-column-header.tsx +0 -0
  132. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/data-table-faceted-filter.tsx +0 -0
  133. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/data-table-pagination.tsx +0 -0
  134. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/data-table-row.tsx +0 -0
  135. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/data-table-view-options.tsx +0 -0
  136. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/date-picker.tsx +0 -0
  137. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/mode-switcher.tsx +0 -0
  138. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components/theme-provider.tsx +0 -0
  139. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/components.json +0 -0
  140. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/hooks/actionState.ts +0 -0
  141. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/hooks/apolloClient.ts +0 -0
  142. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/callback/toast-callback.ts +0 -0
  143. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/callback/with-callback.ts +0 -0
  144. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/server/README.md +0 -0
  145. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/server/auth.ts +0 -0
  146. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/server/cookies.ts +0 -0
  147. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/server/evaluation.ts +0 -0
  148. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/server/openai.ts +0 -0
  149. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/server/span.ts +0 -0
  150. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/types/span.d.ts +0 -0
  151. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/types/state.d.ts +0 -0
  152. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/types/usage.d.ts +0 -0
  153. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/lib/utils.ts +0 -0
  154. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/middleware.ts +0 -0
  155. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/next-env.d.ts +0 -0
  156. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/next.config.ts +0 -0
  157. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/package.json +0 -0
  158. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/postcss.config.mjs +0 -0
  159. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/public/peeking-angel.png +0 -0
  160. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/public/thinking-angel.png +0 -0
  161. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/tsconfig.json +0 -0
  162. {divi-0.0.1b1 → divi-0.0.1b3}/apps/web/vercel.json +0 -0
  163. {divi-0.0.1b1 → divi-0.0.1b3}/biome.json +0 -0
  164. {divi-0.0.1b1 → divi-0.0.1b3}/compose-dev.yml +0 -0
  165. {divi-0.0.1b1 → divi-0.0.1b3}/divi/README.md +0 -0
  166. {divi-0.0.1b1 → divi-0.0.1b3}/divi/decorators/__init__.py +0 -0
  167. {divi-0.0.1b1 → divi-0.0.1b3}/divi/decorators/collect.py +0 -0
  168. {divi-0.0.1b1 → divi-0.0.1b3}/divi/decorators/obs_openai.py +0 -0
  169. {divi-0.0.1b1 → divi-0.0.1b3}/divi/decorators/observable.py +0 -0
  170. {divi-0.0.1b1 → divi-0.0.1b3}/divi/decorators/observe.py +0 -0
  171. {divi-0.0.1b1 → divi-0.0.1b3}/divi/evaluation/__init__.py +0 -0
  172. {divi-0.0.1b1 → divi-0.0.1b3}/divi/evaluation/evaluate.py +0 -0
  173. {divi-0.0.1b1 → divi-0.0.1b3}/divi/evaluation/scores.py +0 -0
  174. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/common/v1/common.proto +0 -0
  175. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/common/v1/common_pb2.py +0 -0
  176. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/common/v1/common_pb2.pyi +0 -0
  177. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/core/health/v1/health_service.proto +0 -0
  178. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/core/health/v1/health_service_pb2.py +0 -0
  179. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/core/health/v1/health_service_pb2.pyi +0 -0
  180. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/core/health/v1/health_service_pb2_grpc.py +0 -0
  181. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/metric/v1/metric.proto +0 -0
  182. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/metric/v1/metric_pb2.py +0 -0
  183. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/metric/v1/metric_pb2.pyi +0 -0
  184. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/trace/v1/trace.proto +0 -0
  185. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/trace/v1/trace_pb2.py +0 -0
  186. {divi-0.0.1b1 → divi-0.0.1b3}/divi/proto/trace/v1/trace_pb2.pyi +0 -0
  187. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/__init__.py +0 -0
  188. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/auth/__init__.py +0 -0
  189. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/auth/auth.py +0 -0
  190. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/auth/init.py +0 -0
  191. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/auth/tokman.py +0 -0
  192. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/core/__init__.py +0 -0
  193. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/core/core.py +0 -0
  194. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/core/finish.py +0 -0
  195. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/core/init.py +0 -0
  196. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/datapark/__init__.py +0 -0
  197. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/datapark/datapark.py +0 -0
  198. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/datapark/init.py +0 -0
  199. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/finish.py +0 -0
  200. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/init.py +0 -0
  201. {divi-0.0.1b1 → divi-0.0.1b3}/divi/services/service.py +0 -0
  202. {divi-0.0.1b1 → divi-0.0.1b3}/divi/session/__init__.py +0 -0
  203. {divi-0.0.1b1 → divi-0.0.1b3}/divi/session/session.py +0 -0
  204. {divi-0.0.1b1 → divi-0.0.1b3}/divi/session/setup.py +0 -0
  205. {divi-0.0.1b1 → divi-0.0.1b3}/divi/session/teardown.py +0 -0
  206. {divi-0.0.1b1 → divi-0.0.1b3}/divi/signals/__init__.py +0 -0
  207. {divi-0.0.1b1 → divi-0.0.1b3}/divi/utils.py +0 -0
  208. {divi-0.0.1b1 → divi-0.0.1b3}/docker-compose.yml +0 -0
  209. {divi-0.0.1b1 → divi-0.0.1b3}/docs/developer_tools.md +0 -0
  210. {divi-0.0.1b1 → divi-0.0.1b3}/docs/images/architecture.svg +0 -0
  211. {divi-0.0.1b1 → divi-0.0.1b3}/docs/images/favicon.ico +0 -0
  212. {divi-0.0.1b1 → divi-0.0.1b3}/docs/images/og-image.png +0 -0
  213. {divi-0.0.1b1 → divi-0.0.1b3}/docs/images/storage.svg +0 -0
  214. {divi-0.0.1b1 → divi-0.0.1b3}/docs/images/thinking-angel.png +0 -0
  215. {divi-0.0.1b1 → divi-0.0.1b3}/docs/package_readme.md +0 -0
  216. {divi-0.0.1b1 → divi-0.0.1b3}/go.work +0 -0
  217. {divi-0.0.1b1 → divi-0.0.1b3}/go.work.sum +0 -0
  218. {divi-0.0.1b1 → divi-0.0.1b3}/hatch.toml +0 -0
  219. {divi-0.0.1b1 → divi-0.0.1b3}/package.json +0 -0
  220. {divi-0.0.1b1 → divi-0.0.1b3}/packages/README.md +0 -0
  221. {divi-0.0.1b1 → divi-0.0.1b3}/pnpm-lock.yaml +0 -0
  222. {divi-0.0.1b1 → divi-0.0.1b3}/pnpm-workspace.yaml +0 -0
  223. {divi-0.0.1b1 → divi-0.0.1b3}/pyproject.toml +0 -0
  224. {divi-0.0.1b1 → divi-0.0.1b3}/scripts/README.md +0 -0
  225. {divi-0.0.1b1 → divi-0.0.1b3}/scripts/hatch_build.py +0 -0
  226. {divi-0.0.1b1 → divi-0.0.1b3}/scripts/image_build.py +0 -0
  227. {divi-0.0.1b1 → divi-0.0.1b3}/scripts/key_build.py +0 -0
  228. {divi-0.0.1b1 → divi-0.0.1b3}/scripts/proto_build.py +0 -0
  229. {divi-0.0.1b1 → divi-0.0.1b3}/services/README.md +0 -0
  230. {divi-0.0.1b1 → divi-0.0.1b3}/services/go.mod +0 -0
  231. {divi-0.0.1b1 → divi-0.0.1b3}/services/go.sum +0 -0
  232. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/auth/handler/api.go +0 -0
  233. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/auth/handler/api_key.go +0 -0
  234. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/auth/handler/auth.go +0 -0
  235. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/auth/handler/user.go +0 -0
  236. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/auth/router/router.go +0 -0
  237. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/core/.keep +0 -0
  238. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/datapark/handler/api.go +0 -0
  239. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/datapark/handler/metric.go +0 -0
  240. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/datapark/handler/session.go +0 -0
  241. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/datapark/handler/usage.go +0 -0
  242. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/app/datapark/router/router.go +0 -0
  243. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/auth/auth.go +0 -0
  244. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/auth/middleware.go +0 -0
  245. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/config/config.go +0 -0
  246. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/database/database.go +0 -0
  247. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/model/api_key.go +0 -0
  248. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/model/openai.go +0 -0
  249. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/model/score.go +0 -0
  250. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/model/session.go +0 -0
  251. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/model/trace.go +0 -0
  252. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/model/usage.go +0 -0
  253. {divi-0.0.1b1 → divi-0.0.1b3}/services/internal/pkg/model/user.go +0 -0
  254. {divi-0.0.1b1 → divi-0.0.1b3}/services/pb/common.pb.go +0 -0
  255. {divi-0.0.1b1 → divi-0.0.1b3}/services/pb/health_service.pb.go +0 -0
  256. {divi-0.0.1b1 → divi-0.0.1b3}/services/pb/health_service_grpc.pb.go +0 -0
  257. {divi-0.0.1b1 → divi-0.0.1b3}/services/pb/metric.pb.go +0 -0
  258. {divi-0.0.1b1 → divi-0.0.1b3}/services/pb/trace.pb.go +0 -0
  259. {divi-0.0.1b1 → divi-0.0.1b3}/tests/__init__.py +0 -0
  260. {divi-0.0.1b1 → divi-0.0.1b3}/tests/unit_tests/decorators/test_obs_openai.py +0 -0
  261. {divi-0.0.1b1 → divi-0.0.1b3}/tests/unit_tests/decorators/test_observable.py +0 -0
  262. {divi-0.0.1b1 → divi-0.0.1b3}/turbo.json +0 -0
  263. {divi-0.0.1b1 → divi-0.0.1b3}/uv.lock +0 -0
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,12 @@
1
+ <!-- Thanks for contributing to divine-agent! 🥳
2
+ Given this is a project maintained by volunteers, please read this template to not waste your time, or ours! 😇 -->
3
+
4
+ # Summary
5
+
6
+ <!-- Write a small summary about what is happening here. -->
7
+
8
+ # Checklist
9
+
10
+ - [ ] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
11
+ - [ ] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
12
+ - [ ] I've updated the documentation accordingly.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: divi
3
- Version: 0.0.1b1
3
+ Version: 0.0.1b3
4
4
  Summary: The Agent Platform for Observability & Evaluation
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.11
@@ -10,6 +10,10 @@
10
10
  </a>
11
11
  </p>
12
12
 
13
+ <p align="center">
14
+ <a href="./docs/README_ZH.md">中文</a> / English
15
+ </p>
16
+
13
17
  divine-agent is an observability tool for LLM-based agents, offering tracing, evaluation, and usage statistics.
14
18
 
15
19
  ---
@@ -27,7 +31,7 @@ Requires Python 3.11+
27
31
  pip install divi
28
32
  ```
29
33
 
30
- ## Usage
34
+ ## Trace
31
35
 
32
36
  1. Get API Key from [Web](https://www.divine-agent.com/dashboard/api-keys).
33
37
  2. Create a `.env` file and add the following line:
@@ -36,7 +40,7 @@ pip install divi
36
40
  ```
37
41
  3. Run the following code:
38
42
  ```python
39
- from divi import Score, obs_openai, observable
43
+ from divi import obs_openai, observable
40
44
  from dotenv import load_dotenv
41
45
  from openai import OpenAI
42
46
 
@@ -48,7 +52,6 @@ pip install divi
48
52
  self.client = obs_openai(
49
53
  OpenAI(),
50
54
  name="Pirate",
51
- scores=[Score.instruction_adherence],
52
55
  )
53
56
 
54
57
  @observable(name="Talk with pirate")
@@ -15,7 +15,11 @@
15
15
  "groups": [
16
16
  {
17
17
  "group": "Get Started",
18
- "pages": ["en/introduction", "en/quickstart/trace"]
18
+ "pages": [
19
+ "en/introduction",
20
+ "en/quickstart/trace",
21
+ "en/quickstart/evaluation"
22
+ ]
19
23
  }
20
24
  ]
21
25
  },
@@ -24,7 +28,11 @@
24
28
  "groups": [
25
29
  {
26
30
  "group": "快速开始",
27
- "pages": ["zh/introduction", "zh/quickstart/trace"]
31
+ "pages": [
32
+ "zh/introduction",
33
+ "zh/quickstart/trace",
34
+ "zh/quickstart/evaluation"
35
+ ]
28
36
  }
29
37
  ]
30
38
  }
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: 'Evaluation'
3
+ description: 'Evaluate your agents in one line'
4
+ ---
5
+ import PirateEval from '/snippets/evaluation/pirate-eval.mdx';
6
+ import PirateCustomEval from '/snippets/evaluation/pirate-custom-eval.mdx';
7
+
8
+ <img className="block dark:hidden" src="/images/pirate-eval-example.png" />
9
+ <img className="hidden dark:block" src="/images/pirate-eval-example-dark.png" />
10
+
11
+ ## Behavior Evaluation
12
+
13
+ > Automate evaluation of instruction adherence and task completion for your [traced](./trace) Pirate agent.
14
+
15
+ <PirateEval />
16
+
17
+ ## Custom Configuration
18
+
19
+ | Property | Type | Default | Description |
20
+ |-----------------|--------|---------------------|---------------------|
21
+ | `model` | str | gpt-4o | Model name used for evaluation |
22
+ | `temperature` | float | 0.5 | Temperature parameter for evaluation |
23
+ | `n_rounds` | int | 5 | Number of evaluation rounds |
24
+ | `max_concurrency` | int | 10 | Maximum number of concurrent requests |
25
+ | `api_key` | str | OPENAI_API_KEY | API key for evaluation |
26
+ | `base_url` | str | OPENAI_BASE_URL | Service URL for evaluation |
27
+
28
+ By default, `api_key` and `base_url` will use values from environment variables, and other options are configured as shown in the table above. You can customize the settings as follows:
29
+
30
+ <PirateCustomEval />
31
+
32
+ ## Notes
33
+
34
+ <Warning>The current evaluation functionality depends on OpenAI's [structured output](https://platform.openai.com/docs/guides/structured-outputs). Please ensure that your chosen [model](https://platform.openai.com/docs/models) supports this feature. We strongly recommend using `gpt-4o` or newer models to ensure evaluation effectiveness and compatibility.</Warning>
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: 'Trace'
3
+ description: 'Start observe your agents in under 5 minutes'
4
+ ---
5
+
6
+ import PirateExample from '/snippets/pirate-example.mdx';
7
+
8
+ <img className="block dark:hidden" src="/images/pirate-example.png" />
9
+ <img className="hidden dark:block" src="/images/pirate-example-dark.png" />
10
+
11
+ <Steps>
12
+ <Step title="Create an Account">
13
+ Create an account on [Divine Agent](https://www.divine-agent.com/signup?source=docs).
14
+ </Step>
15
+ <Step title="Install Divi">
16
+ Install the Divine Agent Python package:
17
+ ```shell
18
+ pip install divi
19
+ ```
20
+ </Step>
21
+ <Step title="Get API Key">
22
+ Get API Key from [Web](https://www.divine-agent.com/dashboard/api-keys).
23
+ </Step>
24
+ <Step title="Set up Environment">
25
+ Create a `.env` file and add the following line:
26
+ ```env
27
+ DIVI_API_KEY=your_api_key
28
+ OPENAI_BASE_URL=https://api.openai.com/v1
29
+ OPENAI_API_KEY=your_llm_api_key
30
+ ```
31
+ </Step>
32
+ <Step title="Trace Pirate Agent">
33
+ Run the following code:
34
+ <PirateExample />
35
+ </Step>
36
+ </Steps>
@@ -0,0 +1,40 @@
1
+ ```python Pirate Example {2,15-18} [expandable]
2
+ from divi import obs_openai, observable
3
+ from divi.evaluation import EvaluatorConfig, Score
4
+ from dotenv import load_dotenv
5
+ from openai import OpenAI
6
+
7
+ load_dotenv()
8
+
9
+
10
+ class Pirate:
11
+ def __init__(self):
12
+ self.client = obs_openai(
13
+ OpenAI(),
14
+ name="Pirate",
15
+ scores=[Score.instruction_adherence, Score.task_completion],
16
+ eval=EvaluatorConfig(
17
+ model="gpt-4.1",
18
+ n_rounds=2,
19
+ ),
20
+ )
21
+
22
+ @observable(name="Talk with pirate")
23
+ def talk(self, message: str):
24
+ """Talk like a pirate."""
25
+ res = self.client.chat.completions.create(
26
+ model="gpt-4o",
27
+ messages=[
28
+ {"role": "developer", "content": "Talk like a pirate."},
29
+ {
30
+ "role": "user",
31
+ "content": message,
32
+ },
33
+ ],
34
+ )
35
+ return res.choices[0].message.content
36
+
37
+
38
+ pirate = Pirate()
39
+ pirate.talk("How do I check if a Python object is an instance of a class?")
40
+ ```
@@ -0,0 +1,36 @@
1
+ ```python Pirate Example {2,14} [expandable]
2
+ from divi import obs_openai, observable
3
+ from divi.evaluation import Score
4
+ from dotenv import load_dotenv
5
+ from openai import OpenAI
6
+
7
+ load_dotenv()
8
+
9
+
10
+ class Pirate:
11
+ def __init__(self):
12
+ self.client = obs_openai(
13
+ OpenAI(),
14
+ name="Pirate",
15
+ scores=[Score.instruction_adherence, Score.task_completion],
16
+ )
17
+
18
+ @observable(name="Talk with pirate")
19
+ def talk(self, message: str):
20
+ """Talk like a pirate."""
21
+ res = self.client.chat.completions.create(
22
+ model="gpt-4o",
23
+ messages=[
24
+ {"role": "developer", "content": "Talk like a pirate."},
25
+ {
26
+ "role": "user",
27
+ "content": message,
28
+ },
29
+ ],
30
+ )
31
+ return res.choices[0].message.content
32
+
33
+
34
+ pirate = Pirate()
35
+ pirate.talk("How do I check if a Python object is an instance of a class?")
36
+ ```
@@ -0,0 +1,34 @@
1
+ ```python Pirate Example {1,10-13,15} [expandable]
2
+ from divi import obs_openai, observable
3
+ from dotenv import load_dotenv
4
+ from openai import OpenAI
5
+
6
+ load_dotenv()
7
+
8
+
9
+ class Pirate:
10
+ def __init__(self):
11
+ self.client = obs_openai(
12
+ OpenAI(),
13
+ name="Pirate",
14
+ )
15
+
16
+ @observable(name="Talk with pirate")
17
+ def talk(self, message: str):
18
+ """Talk like a pirate."""
19
+ res = self.client.chat.completions.create(
20
+ model="gpt-4o",
21
+ messages=[
22
+ {"role": "developer", "content": "Talk like a pirate."},
23
+ {
24
+ "role": "user",
25
+ "content": message,
26
+ },
27
+ ],
28
+ )
29
+ return res.choices[0].message.content
30
+
31
+
32
+ pirate = Pirate()
33
+ pirate.talk("How do I check if a Python object is an instance of a class?")
34
+ ```
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: '评估'
3
+ description: '一行代码完成智能体评估'
4
+ ---
5
+ import PirateEval from '/snippets/evaluation/pirate-eval.mdx';
6
+ import PirateCustomEval from '/snippets/evaluation/pirate-custom-eval.mdx';
7
+
8
+ <img className="block dark:hidden" src="/images/pirate-eval-example.png" />
9
+ <img className="hidden dark:block" src="/images/pirate-eval-example-dark.png" />
10
+
11
+ ## 行为评估
12
+
13
+ > 自动化评估[跟踪](./trace)的海盗 (Pirate) 智能体的指令遵从性和任务完成度。
14
+
15
+ <PirateEval />
16
+
17
+ ## 自定义设置
18
+
19
+ | Property | Type | Default | Description |
20
+ |-----------------|--------|:-------------------:|---------------------|
21
+ | `model` | str | gpt-4o | 用于评估的模型名称 |
22
+ | `temperature` | float | 0.5 | 评估过程中的温度参数 |
23
+ | `n_rounds` | int | 5 | 评估的轮数 |
24
+ | `max_concurrency` | int | 10 | 最大并发请求数 |
25
+ | `api_key` | str | OPENAI_API_KEY | 用于评估的 API 密钥 |
26
+ | `base_url` | str | OPENAI_BASE_URL | 评估所用的服务商 URL |
27
+
28
+ 默认情况下,`api_key` 与 `base_url` 会使用环境变量中的值,其他选项配置如上表所示。您可以通过以下方式自定义设置:
29
+
30
+ <PirateCustomEval />
31
+
32
+ ## 注意事项
33
+
34
+ <Warning>当前评估功能依赖于 OpenAI 的[结构化输出](https://platform.openai.com/docs/guides/structured-outputs),请确保您所选择的[模型](https://platform.openai.com/docs/models)支持该功能,我们强烈建议使用 `gpt-4o` 或更新版本的模型以确保评估效果和兼容性。</Warning>
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: '追踪'
3
+ description: '5 分钟内开启智能体追踪'
4
+ ---
5
+
6
+ import PirateExample from '/snippets/pirate-example.mdx';
7
+
8
+ <img className="block dark:hidden" src="/images/pirate-example.png" />
9
+ <img className="hidden dark:block" src="/images/pirate-example-dark.png" />
10
+
11
+ <Steps>
12
+ <Step title="创建账户">
13
+ 在 [Divine Agent](https://www.divine-agent.com/signup?source=docs) 上创建一个账户。
14
+ </Step>
15
+ <Step title="安装 Divi">
16
+ 安装 Divine Agent Python 包:
17
+ ```shell
18
+ pip install divi
19
+ ```
20
+ </Step>
21
+ <Step title="获取 API Key">
22
+ 从 [Web](https://www.divine-agent.com/dashboard/api-keys) 获取 API Key。
23
+ </Step>
24
+ <Step title="设置环境">
25
+ 创建一个 `.env` 文件并添加以下行:
26
+ ```env
27
+ DIVI_API_KEY=your_api_key
28
+ OPENAI_BASE_URL=https://api.openai.com/v1
29
+ OPENAI_API_KEY=your_llm_api_key
30
+ ```
31
+ </Step>
32
+ <Step title="追踪 Pirate Agent">
33
+ 运行以下代码:
34
+ <PirateExample />
35
+ </Step>
36
+ </Steps>
@@ -35,7 +35,7 @@ export function CreateDialog() {
35
35
  return (
36
36
  <Dialog>
37
37
  <DialogTrigger asChild>
38
- <Button size="sm">
38
+ <Button size="sm" className="h-7">
39
39
  <IconPlus />
40
40
  Create API Key
41
41
  </Button>
@@ -1,5 +1,3 @@
1
- import { AppSidebar } from './components/app-sidebar';
2
- import { SiteHeader } from './components/site-header';
3
1
  import { getCurrentUser } from '@/lib/server/auth';
4
2
  import { deleteSessionTokenCookie } from '@/lib/server/cookies';
5
3
  import {
@@ -9,6 +7,8 @@ import {
9
7
  import { cookies } from 'next/headers';
10
8
  import { redirect } from 'next/navigation';
11
9
  import type { CSSProperties, ReactNode } from 'react';
10
+ import { AppSidebar } from './components/app-sidebar';
11
+ import { SiteHeader } from './components/site-header';
12
12
 
13
13
  /**
14
14
  * Sign out
@@ -29,7 +29,8 @@ export default async function DashboardLayout({
29
29
  modal?: ReactNode;
30
30
  }) {
31
31
  const cookieStore = await cookies();
32
- const defaultOpen = cookieStore.get('sidebar_state')?.value === 'true';
32
+ // defaultOpen is true if the cookie 'sidebar_state' is not set or is set to 'true'
33
+ const defaultOpen = cookieStore.get('sidebar_state')?.value !== 'false';
33
34
  const user = await getCurrentUser();
34
35
  if (!user) {
35
36
  return null;
@@ -18,6 +18,7 @@ import {
18
18
  DrawerTitle,
19
19
  } from '@workspace/ui/components/drawer';
20
20
  import { useMediaQuery } from '@workspace/ui/hooks/use-media-query';
21
+ import { useIsMobile } from '@workspace/ui/hooks/use-mobile';
21
22
  import { Expand } from 'lucide-react';
22
23
  import { usePathname, useRouter } from 'next/navigation';
23
24
  import type * as React from 'react';
@@ -88,15 +89,20 @@ export function ResponsiveDrawer({
88
89
  setTimeout(router.back, 200);
89
90
  }
90
91
  };
92
+ const isMobile = useIsMobile();
93
+ if (isMobile === undefined) {
94
+ return null;
95
+ }
96
+ const _direction = isMobile ? 'bottom' : 'right';
91
97
 
92
98
  return (
93
99
  <Drawer
94
100
  defaultOpen={false}
95
101
  open={open}
96
102
  onOpenChange={handleOpenChange}
97
- direction="right"
103
+ direction={_direction}
98
104
  >
99
- <DrawerContent>
105
+ <DrawerContent className={isMobile ? 'h-[75vh]' : 'h-screen'}>
100
106
  <DrawerHeader>
101
107
  <DrawerTitle className="flex items-center justify-between">
102
108
  <Button variant="ghost" size="icon" asChild>
@@ -13,5 +13,5 @@ _auth: Optional[Auth] = None
13
13
  _datapark: Optional[DataPark] = None
14
14
  _evaluator: Optional[Evaluator] = None
15
15
 
16
- __version__ = "0.0.1b1"
16
+ __version__ = "0.0.1b3"
17
17
  __all__ = ["obs_openai", "observable"]
@@ -19,6 +19,7 @@ class EvaluatorConfig:
19
19
  max_concurrency: int = 10,
20
20
  api_key: Optional[str] = None,
21
21
  base_url: Optional[str] = None,
22
+ language: str = "zh",
22
23
  ):
23
24
  self.model = model
24
25
  self.api_key = api_key
@@ -26,6 +27,7 @@ class EvaluatorConfig:
26
27
  self.temperature = temperature
27
28
  self.n_rounds = n_rounds
28
29
  self.max_concurrency = max_concurrency
30
+ self.language = language
29
31
 
30
32
 
31
33
  class EvaluationResult(BaseModel):
@@ -52,17 +54,22 @@ class Evaluator:
52
54
  )
53
55
 
54
56
  @staticmethod
55
- def generate_prompt(target: str, conversation: str, score: Score) -> str:
57
+ def generate_prompt(
58
+ target: str, conversation: str, score: Score, language: str
59
+ ) -> str:
56
60
  return PROMPT_TEMPLATE.format(
57
61
  requirements=PRESET_PROMPT[score.value],
58
62
  target=target,
59
63
  conversation=conversation,
64
+ language=language,
60
65
  )
61
66
 
62
67
  def _sync_evaluate_once(
63
68
  self, target: str, conversation: str, score: Score
64
69
  ) -> Optional[EvaluationResult]:
65
- prompt = self.generate_prompt(target, conversation, score)
70
+ prompt = self.generate_prompt(
71
+ target, conversation, score, self.config.language
72
+ )
66
73
  response = self.sync_client.beta.chat.completions.parse(
67
74
  model=self.config.model,
68
75
  messages=[{"role": "user", "content": prompt}],
@@ -77,7 +84,9 @@ class Evaluator:
77
84
  async def _async_evaluate_once(
78
85
  self, target: str, conversation: str, score: Score
79
86
  ) -> Optional[EvaluationResult]:
80
- prompt = self.generate_prompt(target, conversation, score)
87
+ prompt = self.generate_prompt(
88
+ target, conversation, score, self.config.language
89
+ )
81
90
  response = await self.async_client.beta.chat.completions.parse(
82
91
  model=self.config.model,
83
92
  messages=[{"role": "user", "content": prompt}],
@@ -8,7 +8,7 @@ PROMPT_TEMPLATE = (
8
8
  "Strictly output your answer in the following JSON format:\n"
9
9
  "{{\n"
10
10
  ' "judgment": bool, # true if the response meets all requirements\n'
11
- ' "reasoning": "string" # concise explanation, hitting only the key points\n'
11
+ ' "reasoning": "string" # concise explanation, in {language}, hitting only the key points\n'
12
12
  "}}\n"
13
13
  "Do not output anything else."
14
14
  )
@@ -1,3 +1,4 @@
1
+ import atexit
1
2
  import os
2
3
  import time
3
4
  from enum import Enum
@@ -62,6 +63,8 @@ class Span:
62
63
  """Start the span by recording the current time in nanoseconds."""
63
64
  self.start_time_unix_nano = time.time_ns()
64
65
  self.upsert_span()
66
+ # Register the end method to be called at exit
67
+ atexit.register(self.end)
65
68
 
66
69
  def end(self):
67
70
  """End the span by recording the end time in nanoseconds."""
@@ -69,6 +72,8 @@ class Span:
69
72
  raise ValueError("Span must be started before ending.")
70
73
  self.end_time_unix_nano = time.time_ns()
71
74
  self.upsert_span()
75
+ # Unregister the end method
76
+ atexit.unregister(self.end)
72
77
 
73
78
  def _add_node(self, trace_id: UUID4, parent_id: Optional[bytes] = None):
74
79
  """Add node for obs tree."""
@@ -1,3 +1,4 @@
1
+ import atexit
1
2
  from datetime import UTC, datetime
2
3
  from typing import Optional
3
4
  from uuid import uuid4
@@ -63,6 +64,8 @@ class Trace:
63
64
  """Start the trace by recording the current time in nanoseconds."""
64
65
  self.start_time = datetime.now(UTC).isoformat()
65
66
  self.upsert_trace()
67
+ # Register the end method to be called on exit
68
+ atexit.register(self.end)
66
69
 
67
70
  def end(self):
68
71
  """End the trace by recording the end time in nanoseconds."""
@@ -70,6 +73,8 @@ class Trace:
70
73
  raise ValueError("Span must be started before ending.")
71
74
  self.end_time = datetime.now(UTC).isoformat()
72
75
  self.upsert_trace()
76
+ # Unregister the end method to prevent multiple calls
77
+ atexit.unregister(self.end)
73
78
 
74
79
  def upsert_trace(self):
75
80
  """Upsert trace with datapark."""