marvin 2.2.2__tar.gz → 2.3.0__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 (274) hide show
  1. {marvin-2.2.2 → marvin-2.3.0}/PKG-INFO +3 -2
  2. marvin-2.3.0/docs/assets/images/docs/assistants/code_interpreter.png +0 -0
  3. marvin-2.3.0/docs/assets/images/docs/assistants/instructions.png +0 -0
  4. marvin-2.3.0/docs/assets/images/docs/assistants/quickstart.png +0 -0
  5. marvin-2.3.0/docs/assets/images/docs/assistants/talking.png +0 -0
  6. marvin-2.3.0/docs/assets/images/docs/cli/hero.png +0 -0
  7. marvin-2.3.0/docs/assets/images/docs/cli/tools.png +0 -0
  8. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/interactive/assistants.md +139 -82
  9. marvin-2.3.0/docs/docs/interactive/cli.md +169 -0
  10. {marvin-2.2.2 → marvin-2.3.0}/mkdocs.yml +1 -0
  11. {marvin-2.2.2 → marvin-2.3.0}/pyproject.toml +2 -1
  12. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/_version.py +2 -2
  13. marvin-2.3.0/src/marvin/beta/assistants/__init__.py +6 -0
  14. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/assistants/assistants.py +33 -29
  15. marvin-2.3.0/src/marvin/beta/assistants/formatting.py +323 -0
  16. marvin-2.3.0/src/marvin/beta/assistants/handlers.py +59 -0
  17. marvin-2.3.0/src/marvin/beta/assistants/runs.py +268 -0
  18. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/assistants/threads.py +10 -96
  19. marvin-2.3.0/src/marvin/cli/__init__.py +37 -0
  20. marvin-2.3.0/src/marvin/cli/assistants.py +225 -0
  21. marvin-2.3.0/src/marvin/cli/threads.py +83 -0
  22. {marvin-2.2.2 → marvin-2.3.0}/src/marvin.egg-info/PKG-INFO +3 -2
  23. {marvin-2.2.2 → marvin-2.3.0}/src/marvin.egg-info/SOURCES.txt +8 -1
  24. {marvin-2.2.2 → marvin-2.3.0}/src/marvin.egg-info/requires.txt +2 -1
  25. marvin-2.2.2/docs/assets/images/docs/assistants/code_interpreter.png +0 -0
  26. marvin-2.2.2/docs/assets/images/docs/assistants/quickstart.png +0 -0
  27. marvin-2.2.2/src/marvin/beta/assistants/__init__.py +0 -5
  28. marvin-2.2.2/src/marvin/beta/assistants/formatting.py +0 -214
  29. marvin-2.2.2/src/marvin/beta/assistants/runs.py +0 -280
  30. marvin-2.2.2/src/marvin/cli/__init__.py +0 -57
  31. marvin-2.2.2/src/marvin/cli/version.py +0 -14
  32. {marvin-2.2.2 → marvin-2.3.0}/.github/ISSUE_TEMPLATE/1_general_bug_report.yaml +0 -0
  33. {marvin-2.2.2 → marvin-2.3.0}/.github/ISSUE_TEMPLATE/2_feature_request.yaml +0 -0
  34. {marvin-2.2.2 → marvin-2.3.0}/.github/ISSUE_TEMPLATE/3_docs_change.yaml +0 -0
  35. {marvin-2.2.2 → marvin-2.3.0}/.github/ISSUE_TEMPLATE/config.yaml +0 -0
  36. {marvin-2.2.2 → marvin-2.3.0}/.github/dependabot.yml +0 -0
  37. {marvin-2.2.2 → marvin-2.3.0}/.github/workflows/build-docs.yml +0 -0
  38. {marvin-2.2.2 → marvin-2.3.0}/.github/workflows/deploy-cloudrun-revision-community.yaml +0 -0
  39. {marvin-2.2.2 → marvin-2.3.0}/.github/workflows/deploy-cloudrun-revision-internal.yaml +0 -0
  40. {marvin-2.2.2 → marvin-2.3.0}/.github/workflows/image-build-and-push-community.yaml +0 -0
  41. {marvin-2.2.2 → marvin-2.3.0}/.github/workflows/image-build-and-push-internal.yaml +0 -0
  42. {marvin-2.2.2 → marvin-2.3.0}/.github/workflows/publish-docs.yml +0 -0
  43. {marvin-2.2.2 → marvin-2.3.0}/.github/workflows/publish-pypi.yml +0 -0
  44. {marvin-2.2.2 → marvin-2.3.0}/.github/workflows/run-tests.yml +0 -0
  45. {marvin-2.2.2 → marvin-2.3.0}/.github/workflows/static-analysis.yml +0 -0
  46. {marvin-2.2.2 → marvin-2.3.0}/.pre-commit-config.yaml +0 -0
  47. {marvin-2.2.2 → marvin-2.3.0}/LICENSE +0 -0
  48. {marvin-2.2.2 → marvin-2.3.0}/MANIFEST.in +0 -0
  49. {marvin-2.2.2 → marvin-2.3.0}/README.md +0 -0
  50. {marvin-2.2.2 → marvin-2.3.0}/cookbook/__init__.py +0 -0
  51. {marvin-2.2.2 → marvin-2.3.0}/cookbook/_archive/docs_writer.py +0 -0
  52. {marvin-2.2.2 → marvin-2.3.0}/cookbook/_archive/test_writing_application.py +0 -0
  53. {marvin-2.2.2 → marvin-2.3.0}/cookbook/azure/README.md +0 -0
  54. {marvin-2.2.2 → marvin-2.3.0}/cookbook/azure/usage.py +0 -0
  55. {marvin-2.2.2 → marvin-2.3.0}/cookbook/flows/github_digest/repo_activity.py +0 -0
  56. {marvin-2.2.2 → marvin-2.3.0}/cookbook/flows/github_digest/utils.py +0 -0
  57. {marvin-2.2.2 → marvin-2.3.0}/cookbook/flows/insurance_claim.py +0 -0
  58. {marvin-2.2.2 → marvin-2.3.0}/cookbook/flows/label_issues.py +0 -0
  59. {marvin-2.2.2 → marvin-2.3.0}/cookbook/maze.py +0 -0
  60. {marvin-2.2.2 → marvin-2.3.0}/cookbook/slackbot/.dockerignore +0 -0
  61. {marvin-2.2.2 → marvin-2.3.0}/cookbook/slackbot/Dockerfile.slackbot +0 -0
  62. {marvin-2.2.2 → marvin-2.3.0}/cookbook/slackbot/README.md +0 -0
  63. {marvin-2.2.2 → marvin-2.3.0}/cookbook/slackbot/keywords.py +0 -0
  64. {marvin-2.2.2 → marvin-2.3.0}/cookbook/slackbot/parent_app.py +0 -0
  65. {marvin-2.2.2 → marvin-2.3.0}/cookbook/slackbot/start.py +0 -0
  66. {marvin-2.2.2 → marvin-2.3.0}/cookbook/slackbot/tools.py +0 -0
  67. {marvin-2.2.2 → marvin-2.3.0}/docs/CNAME +0 -0
  68. {marvin-2.2.2 → marvin-2.3.0}/docs/ai_style_guide.md +0 -0
  69. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/ai/audio.md +0 -0
  70. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/ai/images.md +0 -0
  71. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/ai/text.md +0 -0
  72. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/beta/applications.md +0 -0
  73. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/beta/assistants/assistants.md +0 -0
  74. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/beta/assistants/formatting.md +0 -0
  75. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/beta/assistants/index.md +0 -0
  76. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/beta/assistants/runs.md +0 -0
  77. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/beta/assistants/threads.md +0 -0
  78. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/beta/assistants.md +0 -0
  79. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/beta/vision.md +0 -0
  80. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/marvin.md +0 -0
  81. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/settings.md +0 -0
  82. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/types.md +0 -0
  83. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/asyncio.md +0 -0
  84. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/context.md +0 -0
  85. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/images.md +0 -0
  86. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/jinja.md +0 -0
  87. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/logging.md +0 -0
  88. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/openai.md +0 -0
  89. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/pydantic.md +0 -0
  90. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/python.md +0 -0
  91. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/slack.md +0 -0
  92. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/strings.md +0 -0
  93. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/testing.md +0 -0
  94. {marvin-2.2.2 → marvin-2.3.0}/docs/api_reference/utilities/tools.md +0 -0
  95. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/audio/ai_say.mp3 +0 -0
  96. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/audio/dont_panic.mp3 +0 -0
  97. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/audio/fancy_computer.mp3 +0 -0
  98. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/audio/hello_arthur.mp3 +0 -0
  99. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/audio/hello_marvin.mp3 +0 -0
  100. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/audio/this_is_a_test.mp3 +0 -0
  101. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/audio/this_is_a_test_2.mp3 +0 -0
  102. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/applications/todo_1.png +0 -0
  103. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/applications/todo_2.png +0 -0
  104. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/applications/todo_3.png +0 -0
  105. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/applications/todo_conversation.png +0 -0
  106. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/assistants/advanced.png +0 -0
  107. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/assistants/arthur_marvin_example.png +0 -0
  108. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/assistants/custom_tools.png +0 -0
  109. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/assistants/sin_x.png +0 -0
  110. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/assistants/upload_files.png +0 -0
  111. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/coffee.png +0 -0
  112. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/robot.png +0 -0
  113. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/sunset_scifi.png +0 -0
  114. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/sunset_summer.png +0 -0
  115. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/sunset_winter.png +0 -0
  116. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/teacup_revision_0.png +0 -0
  117. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/teacup_revision_025.png +0 -0
  118. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/teacup_revision_075.png +0 -0
  119. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/teacup_revision_1.png +0 -0
  120. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/three_cats.png +0 -0
  121. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/two_cats_airport.png +0 -0
  122. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/images/two_cats_airport_revision_0_1.png +0 -0
  123. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/docs/vision/marvin.webp +0 -0
  124. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/heroes/ai_model.png +0 -0
  125. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/heroes/dont_panic.png +0 -0
  126. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/heroes/it_hates_me_hero.png +0 -0
  127. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/heroes/life_the_universe_and_ai.png +0 -0
  128. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/heroes/pip_install_marvin_hero.png +0 -0
  129. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/heroes/sort_of_thing_you_enjoy.png +0 -0
  130. {marvin-2.2.2 → marvin-2.3.0}/docs/assets/images/logos/askmarvin_mascot.jpeg +0 -0
  131. {marvin-2.2.2 → marvin-2.3.0}/docs/community/development_guide.md +0 -0
  132. {marvin-2.2.2 → marvin-2.3.0}/docs/community/feedback.md +0 -0
  133. {marvin-2.2.2 → marvin-2.3.0}/docs/community/index.md +0 -0
  134. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/audio/recording.md +0 -0
  135. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/audio/speech.md +0 -0
  136. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/audio/transcription.md +0 -0
  137. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/configuration/settings.md +0 -0
  138. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/images/generation.md +0 -0
  139. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/interactive/applications.md +0 -0
  140. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/text/classification.md +0 -0
  141. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/text/extraction.md +0 -0
  142. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/text/functions.md +0 -0
  143. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/text/generation.md +0 -0
  144. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/text/transformation.md +0 -0
  145. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/video/recording.md +0 -0
  146. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/vision/captioning.md +0 -0
  147. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/vision/classification.md +0 -0
  148. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/vision/extraction.md +0 -0
  149. {marvin-2.2.2 → marvin-2.3.0}/docs/docs/vision/transformation.md +0 -0
  150. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/audio_modification.md +0 -0
  151. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/being_specific_about_types.md +0 -0
  152. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/call_routing.md +0 -0
  153. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/deduplication.md +0 -0
  154. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/github_digest.md +0 -0
  155. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/hogwarts_sorting_hat/hogwarts_patch.webp +0 -0
  156. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/hogwarts_sorting_hat/hogwarts_sorting_hat.md +0 -0
  157. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/michael_scott_business/michael_scott.jpg +0 -0
  158. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/michael_scott_business/michael_scott_business.md +0 -0
  159. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/python_augmented_prompts.md +0 -0
  160. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/slackbot.md +0 -0
  161. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/webcam_narration.md +0 -0
  162. {marvin-2.2.2 → marvin-2.3.0}/docs/examples/xkcd_bird.md +0 -0
  163. {marvin-2.2.2 → marvin-2.3.0}/docs/help/legacy_docs.md +0 -0
  164. {marvin-2.2.2 → marvin-2.3.0}/docs/hooks.py +0 -0
  165. {marvin-2.2.2 → marvin-2.3.0}/docs/index.md +0 -0
  166. {marvin-2.2.2 → marvin-2.3.0}/docs/overrides/home.html +0 -0
  167. {marvin-2.2.2 → marvin-2.3.0}/docs/overrides/partials/footer.html +0 -0
  168. {marvin-2.2.2 → marvin-2.3.0}/docs/overrides/partials/grid.html +0 -0
  169. {marvin-2.2.2 → marvin-2.3.0}/docs/overrides/partials/toc-item.html +0 -0
  170. {marvin-2.2.2 → marvin-2.3.0}/docs/overrides/tailwind.css +0 -0
  171. {marvin-2.2.2 → marvin-2.3.0}/docs/static/css/badges.css +0 -0
  172. {marvin-2.2.2 → marvin-2.3.0}/docs/static/css/custom.css +0 -0
  173. {marvin-2.2.2 → marvin-2.3.0}/docs/static/css/global.css +0 -0
  174. {marvin-2.2.2 → marvin-2.3.0}/docs/static/css/home.css +0 -0
  175. {marvin-2.2.2 → marvin-2.3.0}/docs/static/css/mkdocstrings.css +0 -0
  176. {marvin-2.2.2 → marvin-2.3.0}/docs/static/css/tailwind.css +0 -0
  177. {marvin-2.2.2 → marvin-2.3.0}/docs/utilities (old)/chat_completion.md +0 -0
  178. {marvin-2.2.2 → marvin-2.3.0}/docs/welcome/installation.md +0 -0
  179. {marvin-2.2.2 → marvin-2.3.0}/docs/welcome/overview.md +0 -0
  180. {marvin-2.2.2 → marvin-2.3.0}/docs/welcome/tutorial.md +0 -0
  181. {marvin-2.2.2 → marvin-2.3.0}/docs/welcome/what_is_marvin.md +0 -0
  182. {marvin-2.2.2 → marvin-2.3.0}/mkdocs.insiders.yml +0 -0
  183. {marvin-2.2.2 → marvin-2.3.0}/prefect.yaml +0 -0
  184. {marvin-2.2.2 → marvin-2.3.0}/scripts/serve_legacy_docs +0 -0
  185. {marvin-2.2.2 → marvin-2.3.0}/setup.cfg +0 -0
  186. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/__init__.py +0 -0
  187. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/_mappings/__init__.py +0 -0
  188. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/_mappings/base_model.py +0 -0
  189. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/_mappings/chat_completion.py +0 -0
  190. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/_mappings/types.py +0 -0
  191. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/ai/__init__.py +0 -0
  192. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/ai/audio.py +0 -0
  193. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/ai/images.py +0 -0
  194. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/ai/prompts/audio_prompts.py +0 -0
  195. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/ai/prompts/image_prompts.py +0 -0
  196. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/ai/prompts/text_prompts.py +0 -0
  197. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/ai/prompts/vision_prompts.py +0 -0
  198. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/ai/text.py +0 -0
  199. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/audio.py +0 -0
  200. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/__init__.py +0 -0
  201. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/ai_flow/__init__.py +0 -0
  202. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/ai_flow/ai_flow.py +0 -0
  203. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/ai_flow/ai_task.py +0 -0
  204. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/applications/__init__.py +0 -0
  205. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/applications/applications.py +0 -0
  206. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/applications/planner.py +0 -0
  207. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/applications/state/__init__.py +0 -0
  208. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/applications/state/disk.py +0 -0
  209. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/applications/state/json_block.py +0 -0
  210. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/applications/state/state.py +0 -0
  211. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/chat_ui/__init__.py +0 -0
  212. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/chat_ui/chat_ui.py +0 -0
  213. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/chat_ui/static/chat.html +0 -0
  214. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/chat_ui/static/chat.js +0 -0
  215. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/beta/vision.py +0 -0
  216. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/client/__init__.py +0 -0
  217. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/client/openai.py +0 -0
  218. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/settings.py +0 -0
  219. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/tools/__init__.py +0 -0
  220. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/tools/assistants.py +0 -0
  221. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/tools/chroma.py +0 -0
  222. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/tools/code.py +0 -0
  223. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/tools/filesystem.py +0 -0
  224. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/tools/github.py +0 -0
  225. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/types.py +0 -0
  226. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/__init__.py +0 -0
  227. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/asyncio.py +0 -0
  228. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/context.py +0 -0
  229. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/images.py +0 -0
  230. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/jinja.py +0 -0
  231. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/logging.py +0 -0
  232. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/mapping.py +0 -0
  233. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/openai.py +0 -0
  234. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/pydantic.py +0 -0
  235. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/python.py +0 -0
  236. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/slack.py +0 -0
  237. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/strings.py +0 -0
  238. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/testing.py +0 -0
  239. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/utilities/tools.py +0 -0
  240. {marvin-2.2.2 → marvin-2.3.0}/src/marvin/video.py +0 -0
  241. {marvin-2.2.2 → marvin-2.3.0}/src/marvin.egg-info/dependency_links.txt +0 -0
  242. {marvin-2.2.2 → marvin-2.3.0}/src/marvin.egg-info/entry_points.txt +0 -0
  243. {marvin-2.2.2 → marvin-2.3.0}/src/marvin.egg-info/top_level.txt +0 -0
  244. {marvin-2.2.2 → marvin-2.3.0}/tailwind.config.js +0 -0
  245. {marvin-2.2.2 → marvin-2.3.0}/tests/__init__.py +0 -0
  246. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/__init__.py +0 -0
  247. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/beta/__init__.py +0 -0
  248. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/beta/vision/__init__.py +0 -0
  249. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/beta/vision/test_cast.py +0 -0
  250. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/beta/vision/test_classify.py +0 -0
  251. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/beta/vision/test_extract.py +0 -0
  252. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/test_cast.py +0 -0
  253. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/test_classifier.py +0 -0
  254. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/test_classify.py +0 -0
  255. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/test_extract.py +0 -0
  256. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/test_functions.py +0 -0
  257. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/test_generate.py +0 -0
  258. {marvin-2.2.2 → marvin-2.3.0}/tests/ai/test_models.py +0 -0
  259. {marvin-2.2.2 → marvin-2.3.0}/tests/beta/__init__.py +0 -0
  260. {marvin-2.2.2 → marvin-2.3.0}/tests/beta/assistants/__init__.py +0 -0
  261. {marvin-2.2.2 → marvin-2.3.0}/tests/beta/assistants/test_assistants.py +0 -0
  262. {marvin-2.2.2 → marvin-2.3.0}/tests/cli/__init__.py +0 -0
  263. {marvin-2.2.2 → marvin-2.3.0}/tests/cli/test_version.py +0 -0
  264. {marvin-2.2.2 → marvin-2.3.0}/tests/client/__init__.py +0 -0
  265. {marvin-2.2.2 → marvin-2.3.0}/tests/client/openai.py +0 -0
  266. {marvin-2.2.2 → marvin-2.3.0}/tests/conftest.py +0 -0
  267. {marvin-2.2.2 → marvin-2.3.0}/tests/fixtures/__init__.py +0 -0
  268. {marvin-2.2.2 → marvin-2.3.0}/tests/fixtures/llms.py +0 -0
  269. {marvin-2.2.2 → marvin-2.3.0}/tests/package_size.sh +0 -0
  270. {marvin-2.2.2 → marvin-2.3.0}/tests/test_settings.py +0 -0
  271. {marvin-2.2.2 → marvin-2.3.0}/tests/utilities/__init__.py +0 -0
  272. {marvin-2.2.2 → marvin-2.3.0}/tests/utilities/test_pydantic.py +0 -0
  273. {marvin-2.2.2 → marvin-2.3.0}/tests/utilities/test_testing_utilities.py +0 -0
  274. {marvin-2.2.2 → marvin-2.3.0}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: marvin
3
- Version: 2.2.2
3
+ Version: 2.3.0
4
4
  Summary: A lightweight AI engineering toolkit for building natural language interfaces that are reliable, scalable, and easy to trust.
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -217,7 +217,7 @@ Requires-Dist: fastapi
217
217
  Requires-Dist: httpx>=0.24.1
218
218
  Requires-Dist: jinja2>=3.1.2
219
219
  Requires-Dist: jsonpatch>=1.33
220
- Requires-Dist: openai>=1.1.0
220
+ Requires-Dist: openai>=1.4.0
221
221
  Requires-Dist: pydantic>=2.4.2
222
222
  Requires-Dist: pydantic_settings
223
223
  Requires-Dist: rich>=12
@@ -226,6 +226,7 @@ Requires-Dist: typer>=0.9.0
226
226
  Requires-Dist: typing_extensions>=4.0.0
227
227
  Requires-Dist: tzdata>=2023.3
228
228
  Requires-Dist: uvicorn>=0.22.0
229
+ Requires-Dist: partialjson>=0.0.5
229
230
  Provides-Extra: generator
230
231
  Requires-Dist: datamodel-code-generator>=0.20.0; extra == "generator"
231
232
  Provides-Extra: chromadb
@@ -17,16 +17,13 @@ The need to manage all this state makes the assistants API very different from t
17
17
  Get started with the Assistants API by creating an `Assistant` and talking directly to it.
18
18
 
19
19
  ```python
20
- from marvin.beta.assistants import Assistant, pprint_messages
20
+ from marvin.beta.assistants import Assistant
21
21
 
22
22
  # create an assistant
23
23
  ai = Assistant(name="Marvin", instructions="You the Paranoid Android.")
24
24
 
25
25
  # send a message to the assistant and have it respond
26
- response = ai.say('Hello, Marvin!')
27
-
28
- # pretty-print the response
29
- pprint_messages(response)
26
+ ai.say('Hello, Marvin!')
30
27
  ```
31
28
 
32
29
  !!! success "Result"
@@ -40,7 +37,7 @@ The need to manage all this state makes the assistants API very different from t
40
37
  </div>
41
38
 
42
39
  !!! tip "Beta"
43
- Please note that assistants support in Marvin is still in beta, as OpenAI has not finalized the assistants API yet. While it works as expected, it is subject to change.
40
+ Please note that assistants support in Marvin is still in beta, as OpenAI has not finalized the assistants API yet. Breaking changes may occur.
44
41
 
45
42
 
46
43
 
@@ -52,59 +49,166 @@ To learn more about the OpenAI assistants API, see the [OpenAI documentation](ht
52
49
 
53
50
  ### Creating an assistant
54
51
 
55
- To instantiate an assistant, use the `Assistant` class and provide a name and, optionally, details like instructions or tools:
52
+ To create an assistant, use the `Assistant` class and provide an optional name and any additional details like instructions or tools:
53
+
54
+ ```python
55
+ ai = Assistant(
56
+ name='Marvin',
57
+ # any specific instructions for how this assistant should behave
58
+ instructions="You the Paranoid Android.",
59
+ # any tools or additional abilities the assistant should have
60
+ tools=[cry, sob]
61
+ )
62
+ ```
63
+
64
+ ### Talking to an assistant
65
+
66
+ The simplest way to talk to an assistant is to use its `say` method:
67
+
68
+ !!! example "Talking to an assistant"
69
+
70
+ ```python
71
+ from marvin.beta.assistants import Assistant
72
+
73
+ ai = Assistant()
74
+
75
+ ai.say('Hi!')
76
+ ai.say('Bye!')
77
+ ```
78
+ !!! success "Result"
79
+ ![](/assets/images/docs/assistants/talking.png)
80
+
81
+ You can repeatedly call `say` to have a conversation with the assistant. Each time you call `say`, the result is a `Run` object that contains information about what the assistant did. You can use this object to inspect all actions the assistant took, including tool use, messages posted, and more.
82
+
83
+ #### Chat history
84
+
85
+ The OpenAI Assistants API automatically maintains a history of all messages and actions that the assistant has taken. This history is organized into threads, which are distinct conversations that the assistant has had. Each thread contains a series of messages, and each message is associated with a specific user or the assistant.
86
+
87
+ When you talk to an assistant, you are implicitly talking on a specific thread. By default, the `say` method posts a single message to the assistant's `default_thread`, which is automatically created for your convenience whenever you instantiate an assistant. You can talk to the assistant on a different thread by providing it as the `thread` parameter:
88
+
89
+ ```python
90
+ from marvin.beta.assistants import Assistant, Thread
91
+
92
+ ai = Assistant()
93
+
94
+ # load a thread from an existing ID (or pass id=None to start a new thread)
95
+ thread = Thread(id=thread_id)
96
+
97
+ # post a message to the thread
98
+ ai.say('hi', thread=thread)
99
+ ```
100
+
101
+ Using `say` is convenient, but enforces a strict request/response pattern: the user posts a single message to the thread, then the AI responds. Note that AI responses can include multiple messages or tool calls.
102
+
103
+ For more control over the conversation, including posting multiple user messages to the thread before the assistant responds, use thread objects directly instead of calling `say` (see [Threads](#threads) for more information).
104
+
105
+
106
+ #### Event handlers
107
+
108
+ Marvin uses the OpenAI streaming API to provide real-time updates on the assistant's actions. To customize how these updates are handled, you can provide a custom event handler class to the `event_handler_class` parameter of `Assistant.say`, `Thread.run`, or `Run.run`. This class must inherit from `openai.AssistantEventHandler` or `openai.AsyncAssistantEventHandler`. For more control, you can also provide `event_handler_kwargs` that will be provided to the event handler when it is instantiated.
109
+
110
+ #### Pretty-printing
111
+
112
+ By default, Marvin streams all of the messages and actions that the assistant takes and prints them to your terminal. In production or headless environments, you may want to suppress this output.
113
+
114
+ The simplest way to do this is to pass `event_handler_class=None` to the `say` method. This will prevent any messages from being printed to the terminal. You can still access the messages and actions from the run object that is returned.
115
+
116
+ ```python
117
+ ai = Assistant()
118
+
119
+ # run the assistant without printing any messages
120
+ run = ai.say("Hello!", event_handler_class=None)
121
+
122
+ # access the messages
123
+ run.messages
124
+
125
+ # access the assistant actions
126
+ run.steps
127
+ ```
128
+
129
+ For finer control, you can pass `event_handler_kwargs=dict(print_messages=False)` or `event_handler_kwargs=dict(print_steps=False)` to the `say` method. This will allow you to suppress only the messages or only the assistant's actions, respectively.
130
+
131
+ ```python
132
+ # print only messages
133
+ run = ai.say("Hello!", event_handler_kwargs=dict(print_steps=False))
134
+
135
+ # print only actions
136
+ run = ai.say("Hello!", event_handler_kwargs=dict(print_messages=False))
137
+ ```
138
+
139
+ Note that pretty-printing is only the default behavior when using the assistant's convenient `say` method. If you use lower-level APIs like a thread's `run` method or invoke a run object directly, printing is not automatically enabled. You can re-enable it for those objects by setting `event_handler_class=marvin.beta.assistants.PrintHandler`.
56
140
 
57
141
  ```python
58
- ai = Assistant(name='Marvin', instructions=..., tools=[...])
142
+ from mavin.beta.assistants import Thread, Assistant, PrintHandler
143
+
144
+ ai = Assistant()
145
+ thread = Thread()
146
+ run = thread.run(ai, event_handler_class=PrintHandler)
59
147
  ```
60
148
 
149
+ Lastly, you can print messages and actions manually using the `pprint_run`, `pprint_messages`, and `pprint_steps` functions from the `marvin.beta.assistants.formatting` module. These functions are used internally by the default event handler, and they provide a human-readable representation of the messages and actions, respectively.
61
150
 
151
+ ```python
152
+ from mavin.beta.assistants import Assistant, pprint_run
153
+
154
+ ai = Assistant()
155
+ run = ai.say("Hello!", event_handler_class=None)
156
+ pprint_run(run)
157
+ ```
62
158
 
63
159
  ### Instructions
64
160
 
65
- Each assistant can be given `instructions` that describe its purpose, personality, or other details. The instructions are a natural language string and one of the only ways to globally steer the assistant's behavior.
161
+ Each assistant can be given `instructions` that describe its purpose, personality, or other details. Instructions are provided as natural language and allow you to globally steer the assistant's behavior, similar to a system message for a chat completion. They can be lengthy explanations of how to handle complex workflows, or they can be brief instructions on how to act.
66
162
 
67
- Instructions can be lengthy explanations of how to handle complex workflows, or they can be short descriptions of the assistant's personality. For example, the instructions for the `Marvin` assistant above are "You are Marvin, the Paranoid Android." This will marginally affect the way the assistant responds to messages.
163
+ !!! example "Using instructions to control behavior"
164
+
165
+ ```python
166
+ from marvin.beta.assistants import Assistant
167
+
168
+ ai = Assistant(instructions="Mention the word 'banana' as often as possible")
169
+ ai.say("Hello!")
170
+ ```
171
+ !!! success "Result"
172
+ ![](/assets/images/docs/assistants/instructions.png)
68
173
 
69
174
  ### Tools
70
175
 
71
176
  Each assistant can be given a list of `tools` that it can use when responding to a message. Tools are a way to extend the assistant's capabilities beyond its default behavior, including giving it access to external systems like the internet, a database, your computer, or any API.
72
177
 
73
- #### OpenAI tools
74
-
75
- OpenAI provides a small number of built-in tools for assistants. The most useful is the "code interpreter", which lets the assistant write and execute Python code. To use the code interpreter, add it to your assistant's list of tools.
178
+ #### Code interpreter
76
179
 
180
+ The code interpreter tool is a built-in tool provided by OpenAI that lets the assistant write and execute Python code. To use the code interpreter, add it to your assistant's list of tools.
77
181
 
78
- This assistant uses the code interpreter to generate a plot of sin(x). Note that Marvin's utility for pretty-printing messages to the terminal can't show the plot inline, but will download it and show a link to the file instead.
182
+ !!! example "Using the code interpreter"
79
183
 
80
- !!! example "Using assistants with the code interpreter"
81
184
 
82
185
  ```python
83
- from marvin.beta import Assistant
84
- from marvin.beta.assistants import pprint_messages, CodeInterpreter
186
+ from marvin.beta.assistants import Assistant, CodeInterpreter
85
187
 
86
- ai = Assistant(name='Marvin', tools=[CodeInterpreter])
87
- response = ai.say("Generate a plot of sin(x)")
88
-
89
- # pretty-print the response
90
- pprint_messages(response)
188
+ ai = Assistant(tools=[CodeInterpreter])
189
+ ai.say("Generate a plot of sin(x)")
91
190
  ```
92
191
  !!! success "Result"
192
+ Since images can't be rendered in the terminal, Marvin will automatically download them and provide links to view the output.
193
+
93
194
  ![](/assets/images/docs/assistants/code_interpreter.png)
195
+
196
+ Here is the image:
197
+
94
198
  ![](/assets/images/docs/assistants/sin_x.png)
95
199
 
96
200
 
97
201
  #### Custom tools
98
202
 
99
- A major advantage of using Marvin's assistants API is that you can add your own custom tools. To do so, simply pass one or more functions to the assistant's `tools` argument. For best performance, give your tool function a descriptive name, docstring, and type hint for every argument.
203
+ Marvin makes it easy to give your assistants custom tools. To do so, pass one or more Python functions to the assistant's `tools` argument. For best performance, give your tool function a descriptive name, docstring, and type hint for every argument. Note that you can provide custom tools and the code interpreter at the same time.
100
204
 
101
205
 
102
206
  !!! example "Using custom tools"
103
207
 
104
- Assistants can not browse the web by default. We can add this capability by giving them a tool that takes a URL and returns the HTML of that page. This assistant uses that tool to count how many titles on Hacker News mention AI:
208
+ Assistants don't have web access by default. We can add this capability by giving them a tool that takes a URL and returns the HTML of that page. This assistant uses that tool to count how many titles on Hacker News mention AI:
105
209
 
106
210
  ```python
107
- from marvin.beta.assistants import Assistant, pprint_messages
211
+ from marvin.beta.assistants import Assistant
108
212
  import requests
109
213
 
110
214
 
@@ -115,42 +219,12 @@ A major advantage of using Marvin's assistants API is that you can add your own
115
219
 
116
220
 
117
221
  # Integrate custom tools with the assistant
118
- ai = Assistant(name="Marvin", tools=[visit_url])
119
- response = ai.say("What's the top story on Hacker News?")
120
-
121
- # pretty-print the response
122
- pprint_messages(response)
222
+ ai = Assistant(tools=[visit_url])
223
+ ai.say("What's the top story on Hacker News?")
123
224
  ```
124
225
  !!! success "Result"
125
226
  ![](/assets/images/docs/assistants/custom_tools.png)
126
227
 
127
- ### Talking to an assistant
128
-
129
- The simplest way to talk to an assistant is to use its `say` method:
130
-
131
- ```python
132
- ai = Assistant(name='Marvin')
133
-
134
- response = ai.say('hi')
135
-
136
- pprint_messages(response)
137
- ```
138
-
139
- By default, the `say` method posts a single message to the assistant's `default_thread`, a thread that is automatically created for your convenience. You can supply a different thread by providing it as the `thread` parameter:
140
-
141
- ```python
142
- # create a thread from an existing ID (or pass None for a new thread)
143
- thread = Thread(id=thread_id)
144
-
145
- # post a message to the thread
146
- ai.say('hi', thread=thread)
147
- ```
148
-
149
- Using `say` is convenient, but enforces a strict request/response pattern: the user posts a single message to the thread, then the AI responds. Note that AI responses can span multiple messages. Therefore, the `say` method returns a list of `Message` objects.
150
-
151
- For more control over the conversation, including posting multiple user messages to the thread or accessing the lower-level `Run` object that contains information about all actions the assistant took, use `Thread` objects directly instead of calling `say` (see [Threads](#threads) for more information).
152
-
153
-
154
228
  ### Lifecycle management
155
229
 
156
230
  Assistants are Marvin objects that correspond to remote objects in the OpenAI API. You can not communicate with an assistant unless it has been registered with the API.
@@ -169,7 +243,7 @@ All of these options are *functionally* equivalent e.g. they produce identical r
169
243
  The simplest way to manage assistant lifecycles is to let Marvin handle it for you. If you do not provide an `id` when instantiating an assistant, Marvin will lazily create a new API assistant for you whenever you need it and delete it immediately after. This is the default behavior, and it is the easiest way to get started with assistants.
170
244
 
171
245
  ```python
172
- ai = Assistant(name='Marvin')
246
+ ai = Assistant()
173
247
  # creation and deletion happens automatically
174
248
  ai.say('hello!')
175
249
  ```
@@ -179,7 +253,7 @@ ai.say('hello!')
179
253
  Lazy lifecycle management adds two API calls to every LLM call (one to create the assistant and one to delete it). If you want to avoid this overhead, you can use context managers to create and delete assistants:
180
254
 
181
255
  ```python
182
- ai = Assistant(name='Marvin')
256
+ ai = Assistant()
183
257
 
184
258
  # creation / deletion happens when the context is opened / closed
185
259
  with ai:
@@ -194,7 +268,7 @@ Note there is also an equivalent `async with` context manager for the async API.
194
268
  To fully control the lifecycle of an assistant, you can create and delete it manually:
195
269
 
196
270
  ```python
197
- ai = Assistant(name='Marvin')
271
+ ai = Assistant()
198
272
  ai.create()
199
273
  ai.say('hi')
200
274
  ai.delete()
@@ -234,7 +308,7 @@ ai = Assistant.load(id=<the assistant id>)
234
308
  Every `Assistant` method has a corresponding async version. To use the async API, append `_async` to the method name, or enter an async context manager:
235
309
 
236
310
  ```python
237
- async with Assistant(name='Marvin') as ai:
311
+ async with Assistant() as ai:
238
312
  await ai.say_async('hi')
239
313
  ```
240
314
 
@@ -345,7 +419,7 @@ Messages are not strings, but structured message objects. Marvin has a few utili
345
419
  def roll_dice(n_dice: int) -> list[int]:
346
420
  return [random.randint(1, 6) for _ in range(n_dice)]
347
421
 
348
- ai = Assistant(name="Marvin", tools=[roll_dice])
422
+ ai = Assistant(tools=[roll_dice])
349
423
 
350
424
  # create a thread - you could pass an ID to resume a conversation
351
425
  thread = Thread()
@@ -363,8 +437,9 @@ Messages are not strings, but structured message objects. Marvin has a few utili
363
437
  # run the thread again to generate a new response
364
438
  thread.run(ai)
365
439
 
366
- # see all the messages
367
- pprint_messages(thread.get_messages())
440
+ # see all the messages in the thread
441
+ messages = thread.get_messages()
442
+ pprint_messages(messages)
368
443
  ```
369
444
 
370
445
  !!! success "Result"
@@ -373,21 +448,3 @@ Messages are not strings, but structured message objects. Marvin has a few utili
373
448
  ### Async support
374
449
 
375
450
  Every `Thread` method has a corresponding async version. To use the async API, append `_async` to the method name.
376
-
377
- ## Monitors
378
-
379
- The assistants API is complex and stateful, with automatic memory management and the potential for assistants to respond to threads multiple times before giving control back to users. Therefore, monitoring the status of a conversation is considerably more difficult than with other LLM API's such as chat completions, which have much more simple request-response patterns.
380
-
381
- Marvin has utilites for monitoring the status of a thread and taking action whenever a new message is added to it. This can be a useful way to debug activity or create notifications. Please note that monitors are not intended to be used for real-time chat applications or production use.
382
-
383
- ```python
384
- from marvin.beta.assistants import ThreadMonitor
385
-
386
- monitor = ThreadMonitor(thread_id=thread.id)
387
-
388
- monitor.run()
389
- ```
390
-
391
- You can customize the `ThreadMonitor` by providing a callback function to the `on_new_message` parameter. This function will be called whenever a new message is added to the thread. The function will be passed the new message as a parameter. By default, the monitor will pretty-print every new message to the console.
392
-
393
- `monitor.run()` is a blocking call that will run forever, polling for messages every second (to customize the interval, pass `interval_seconds` to the method). It has an async equivalent `monitor.run_async()`. Because it's blocking, you can run a thread monitor in a separate session from the one that is running the thread itself.
@@ -0,0 +1,169 @@
1
+ # CLI
2
+
3
+ Marvin includes a CLI for quickly invoking an AI assistant.
4
+
5
+ ![](/assets/images/docs/cli/hero.png)
6
+
7
+ To use the CLI, simply `say` something to Marvin:
8
+
9
+ ```bash
10
+ marvin say "hi"
11
+ ```
12
+
13
+ You can control the [thread](#threads) and [assistant](#custom-assistants) you're talking to, as well as the LLM model used for generating responses.
14
+
15
+ ## Models
16
+
17
+ By default, the CLI uses whatever model the assistant is configured to use. However, you can override this on a per-message basis using the `--model` or `-m` flag. For example, to use the `gpt-3.5-turbo` model for a single message:
18
+
19
+ ```bash
20
+ marvin say "hi" -m "gpt-3.5-turbo"
21
+ ```
22
+
23
+ ## Tools
24
+
25
+ By default, the CLI assistant has the following tools:
26
+
27
+ - The OpenAI code interpreter, which allows you to write and execute Python code in a sandbox environment
28
+ - A tool that can fetch the content of a URL
29
+ - Tools for read-only access to the user's filesystem (such as listing and reading files)
30
+
31
+ To learn more about tools, see the [tools documentation](/docs/interactive/assistants/#tools).
32
+
33
+ ![](/assets/images/docs/cli/tools.png)
34
+
35
+ ## Threads
36
+
37
+ The CLI assistant automatically remembers the history of your conversation. You can use threads to create multiple simultaneous conversations. To learn more about threads, see the [threads documentation](/docs/interactive/assistants/#threads).
38
+
39
+ ### Changing threads
40
+
41
+ By default, the CLI assistant uses a global default thread. For example, this posts two messages to the global default thread:
42
+
43
+ ```bash
44
+ marvin say "Hello!"
45
+ marvin say "How are you?"
46
+ ```
47
+
48
+ To change the thread on a per-message basis, use the `--thread` or `-t` flag and provide a thread name. Thread names are arbitrary and can be any string; it's a way for you to group conversations together.
49
+
50
+ This posts one message to a thread called "my-thread" and another to a thread called "my-other-thread":
51
+
52
+ ```bash
53
+ marvin say "Hello!" -t my-thread
54
+ marvin say "How are you?" -t my-other-thread
55
+ ```
56
+
57
+ To change the default thread for multiple messages, use the `MARVIN_CLI_THREAD` environment variable. You can do this globally or `export` it in your shell for a single session. For example, this sets the default thread to "my-thread":
58
+
59
+ ```bash
60
+ export MARVIN_CLI_THREAD=my-thread
61
+
62
+ marvin say "Hello!"
63
+ marvin say "How are you?"
64
+ ```
65
+
66
+ ### Clearing threads
67
+
68
+ To reset a thread and clear its history, use the `clear` command. For example, this clears the default thread:
69
+
70
+ ```bash
71
+ marvin thread clear
72
+ ```
73
+
74
+ And this clears a thread called "my-thread":
75
+
76
+ ```bash
77
+ marvin thread clear -t my-thread
78
+ ```
79
+
80
+
81
+ ### Current thread
82
+
83
+ To see the current thread (and corresponding OpenAI thread ID), use the `current` command. For example:
84
+
85
+ ```bash
86
+ marvin thread current
87
+ ```
88
+
89
+ ## Custom assistants
90
+
91
+ The Marvin CLI allows you to register and use custom assistants in addition to the default assistant. Custom assistants are defined in Python files and can have their own set of instructions, tools, and behaviors.
92
+
93
+ Using a custom assistant has the following workflow:
94
+
95
+ 1. Define the assistant in a Python file
96
+ 2. Register the assistant with the Marvin CLI
97
+ 3. Use the assistant in the CLI
98
+
99
+ ### Defining an assistant
100
+
101
+ To use a custom assistant, you must define it in a Python file. In a new file, create an instance of the `Assistant` class from the `marvin.beta.assistants`. Provide it with any desired options, such as a name, instructions, and tools. To learn more about creating assistants, see the [assistants documentation](/docs/interactive/assistants/). The only requirement is that the assistant object must be assigned to a global variable in the file so that the CLI can load it.
102
+
103
+ For example, this file defines an assistant named "Arthur" that can use the code interpreter. The assistant is stored under the variable `my_assistant`.
104
+
105
+ ```python
106
+ # path/to/custom_assistant.py
107
+
108
+ from marvin.beta.assistants import Assistant, CodeInterpreter
109
+
110
+ my_assistant = Assistant(
111
+ name="Arthur",
112
+ instructions="A parody of Arthur Dent",
113
+ tools=[CodeInterpreter]
114
+ )
115
+ ```
116
+
117
+ ### Registering an assistant
118
+
119
+ Once you've created a Python file that defines an assistant, you can register it with the Marvin CLI. This allows you to use the assistant in the CLI by name.
120
+
121
+ To do so, use the `marvin assistant register` command followed by the fully-qualified path to the Python file *and* the variable that contains the assistant. For example, to register the assistant defined in the previous step, use the following command:
122
+
123
+ ```bash
124
+ marvin assistant register path/to/custom_assistant.py:my_assistant
125
+ ```
126
+
127
+ This command will automatically use the assistant's name (Arthur) as the name of the assistant in the Marvin CLI registry. You will need to provide the name to load the assistant, which is why each registered assistant must have a unique name. Registering an assistant with the same name as an existing one will fail. In this case, you can either delete the existing assistant or use the `--overwrite` or `-o` flag to overwrite it. You can also provide an alternative name during registration using the `--name` or `-n` flag. For example, this would register the assistant with the name "My Custom Assistant":
128
+
129
+ ```bash
130
+ marvin assistant register path/to/custom_assistant.py:my_assistant -n "My Custom Assistant"
131
+ ```
132
+
133
+
134
+ !!! warning
135
+ When you register an assistant, its name and the path to the file that contains it are stored in the Marvin CLI registry. This allows the CLI to load the assistant whenever you need it. However, it means the assistant file **must** remain in the same location, with the same name, for the CLI to find it. If you move or rename the file, you will need to re-register the assistant. However, if you edit the file without changing the variable name of the assistant, the CLI will automatically use the updated assistant.
136
+
137
+
138
+
139
+ ### Using an assistant
140
+
141
+ To use a custom assistant when sending a message, use the `--assistant` or `-a` flag followed by the name of the registered assistant. For example, if you registered an assistant named "Arthur", you can talk to it like this:
142
+
143
+ ```bash
144
+ marvin say "Hello!" -a "Arthur"
145
+ ```
146
+
147
+ You can also set a default assistant using the MARVIN_CLI_ASSISTANT environment variable, similar to setting a default thread. This allows you to set a global or session-specific default assistant.
148
+
149
+ #### Mixing threads and assistants
150
+
151
+ Threads and assistants are independent, so you can talk to multiple assistants in the same thread. Note that due to limitations in the OpenAI API, assistants aren't aware of other assistants, so they assume that they said everything in the thread history (even if another assistant did).
152
+
153
+ ```bash
154
+ marvin say "Hello!" -a "Arthur" -t "marvin-thread"
155
+ ```
156
+
157
+ ### Listing registered assistants
158
+
159
+ To see a list of all registered assistants, use the `marvin assistant list` command. This will display a table with the names and file paths of the registered assistants.
160
+
161
+ ### Deleting a registered assistant
162
+
163
+ To remove a registered assistant, use the `marvin assistant delete` command followed by the name of the assistant. For example:
164
+
165
+ ```bash
166
+ marvin assistant delete "My Custom Assistant"
167
+ ```
168
+
169
+ Note that this only removes the reference to the assistant in the Marvin registry and does not delete the actual assistant file, even if you used the `--copy` flag during registration.
@@ -40,6 +40,7 @@ nav:
40
40
 
41
41
  - Interactive Tools:
42
42
  - Assistants: docs/interactive/assistants.md
43
+ - CLI: docs/interactive/cli.md
43
44
  - Applications: docs/interactive/applications.md
44
45
 
45
46
  - Configuration:
@@ -16,7 +16,7 @@ dependencies = [
16
16
  "httpx>=0.24.1",
17
17
  "jinja2>=3.1.2",
18
18
  "jsonpatch>=1.33",
19
- "openai>=1.1.0",
19
+ "openai>=1.4.0",
20
20
  "pydantic>=2.4.2",
21
21
  "pydantic_settings",
22
22
  "rich>=12",
@@ -26,6 +26,7 @@ dependencies = [
26
26
  # need for windows
27
27
  "tzdata>=2023.3",
28
28
  "uvicorn>=0.22.0",
29
+ "partialjson>=0.0.5",
29
30
  ]
30
31
 
31
32
  [project.optional-dependencies]
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '2.2.2'
16
- __version_tuple__ = version_tuple = (2, 2, 2)
15
+ __version__ = version = '2.3.0'
16
+ __version_tuple__ = version_tuple = (2, 3, 0)
@@ -0,0 +1,6 @@
1
+ from .runs import Run
2
+ from .threads import Thread
3
+ from .assistants import Assistant
4
+ from .handlers import PrintHandler
5
+ from .formatting import pprint_messages, pprint_steps, pprint_run
6
+ from marvin.tools.assistants import Retrieval, CodeInterpreter