From 3de86de483d56f950e57311f28546920d96c5053 Mon Sep 17 00:00:00 2001 From: <> Date: Tue, 29 Aug 2023 20:15:25 +0000 Subject: [PATCH] Deployed a36eac1 with MkDocs version: 1.5.2 --- .nojekyll | 0 404.html | 1928 +++++ CNAME | 1 + __pycache__/hooks.cpython-39.pyc | Bin 0 -> 610 bytes .../components/ai_application/index.html | 2802 +++++++ .../components/ai_classifier/index.html | 2283 ++++++ .../components/ai_function/index.html | 2189 ++++++ api_reference/components/ai_model/index.html | 2609 +++++++ .../language_models/anthropic/index.html | 2288 ++++++ .../engine/language_models/base/index.html | 2417 ++++++ .../engine/language_models/openai/index.html | 2322 ++++++ api_reference/prompts/base/index.html | 2275 ++++++ api_reference/prompts/library/index.html | 2235 ++++++ api_reference/settings/index.html | 2240 ++++++ .../utilities/async_utils/index.html | 2231 ++++++ api_reference/utilities/embeddings/index.html | 2125 ++++++ api_reference/utilities/history/index.html | 2075 +++++ api_reference/utilities/logging/index.html | 2075 +++++ api_reference/utilities/messages/index.html | 2075 +++++ api_reference/utilities/strings/index.html | 2122 ++++++ api_reference/utilities/types/index.html | 2245 ++++++ assets/_mkdocstrings.css | 64 + assets/images/favicon.png | Bin 0 -> 1870 bytes .../components/ai_application.png | Bin 0 -> 29785 bytes .../components/ai_classifier.png | Bin 0 -> 29679 bytes .../api_reference/components/ai_function.png | Bin 0 -> 28947 bytes .../api_reference/components/ai_model.png | Bin 0 -> 29055 bytes .../engine/language_models/anthropic.png | Bin 0 -> 29756 bytes .../engine/language_models/base.png | Bin 0 -> 27874 bytes .../engine/language_models/openai.png | Bin 0 -> 28735 bytes .../social/api_reference/prompts/base.png | Bin 0 -> 27874 bytes .../social/api_reference/prompts/library.png | Bin 0 -> 27160 bytes .../images/social/api_reference/settings.png | Bin 0 -> 28969 bytes .../api_reference/utilities/async_utils.png | Bin 0 -> 30326 bytes .../api_reference/utilities/embeddings.png | Bin 0 -> 31751 bytes .../api_reference/utilities/history.png | Bin 0 -> 28679 bytes .../api_reference/utilities/logging.png | Bin 0 -> 26966 bytes .../api_reference/utilities/messages.png | Bin 0 -> 29870 bytes .../api_reference/utilities/strings.png | Bin 0 -> 27711 bytes .../social/api_reference/utilities/types.png | Bin 0 -> 28649 bytes .../social/community/development_guide.png | Bin 0 -> 30883 bytes assets/images/social/community/feedback.png | Bin 0 -> 30261 bytes assets/images/social/community/index.png | Bin 0 -> 37420 bytes .../social/components/ai_application.png | Bin 0 -> 30946 bytes .../social/components/ai_classifier.png | Bin 0 -> 31602 bytes .../images/social/components/ai_function.png | Bin 0 -> 28602 bytes assets/images/social/components/ai_model.png | Bin 0 -> 29187 bytes assets/images/social/components/overview.png | Bin 0 -> 29767 bytes .../images/social/configuration/providers.png | Bin 0 -> 30576 bytes .../images/social/configuration/settings.png | Bin 0 -> 30734 bytes assets/images/social/deployment/index.png | Bin 0 -> 26884 bytes .../images/social/examples/github_digest.png | Bin 0 -> 33281 bytes assets/images/social/examples/slackbot.png | Bin 0 -> 30980 bytes assets/images/social/index.png | Bin 0 -> 27238 bytes assets/images/social/llms/llms.png | Bin 0 -> 31507 bytes assets/images/social/llms/prompt.png | Bin 0 -> 34900 bytes .../social/utilities/chat_completion.png | Bin 0 -> 34101 bytes assets/images/social/welcome/installation.png | Bin 0 -> 28602 bytes assets/images/social/welcome/overview.png | Bin 0 -> 29767 bytes assets/images/social/welcome/quickstart.png | Bin 0 -> 31771 bytes .../images/social/welcome/what_is_marvin.png | Bin 0 -> 31148 bytes assets/javascripts/bundle.78eede0e.min.js | 29 + assets/javascripts/bundle.78eede0e.min.js.map | 8 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.dfff1995.min.js | 42 + .../workers/search.dfff1995.min.js.map | 8 + assets/stylesheets/main.0e669242.min.css | 1 + assets/stylesheets/main.0e669242.min.css.map | 1 + assets/stylesheets/palette.85d0ee34.min.css | 1 + .../stylesheets/palette.85d0ee34.min.css.map | 1 + community/development_guide/index.html | 2124 ++++++ community/feedback/index.html | 2045 +++++ community/index.html | 2023 +++++ components/ai_application/index.html | 2385 ++++++ components/ai_classifier/index.html | 2346 ++++++ components/ai_function/index.html | 2311 ++++++ components/ai_model/index.html | 2747 +++++++ components/overview/index.html | 2258 ++++++ configuration/providers/index.html | 2419 ++++++ configuration/settings/index.html | 2185 ++++++ deployment/index.html | 2037 +++++ examples/github_digest/index.html | 2182 ++++++ examples/slackbot/index.html | 2332 ++++++ hooks.py | 21 + img/heroes/ai_model.png | Bin 0 -> 368606 bytes img/heroes/dont_panic.png | Bin 0 -> 139708 bytes img/heroes/it_hates_me_hero.png | Bin 0 -> 179233 bytes img/heroes/life_the_universe_and_ai.png | Bin 0 -> 144163 bytes img/heroes/pip_install_marvin_hero.png | Bin 0 -> 141685 bytes img/heroes/sort_of_thing_you_enjoy.png | Bin 0 -> 155645 bytes img/logos/askmarvin_mascot.jpeg | Bin 0 -> 7138 bytes index.html | 1989 +++++ llms/llms/index.html | 2432 ++++++ llms/prompt/index.html | 2355 ++++++ objects.inv | Bin 0 -> 857 bytes overrides/home.html | 61 + overrides/partials/footer.html | 22 + overrides/partials/grid.html | 14 + overrides/tailwind.css | 26 + search/search_index.json | 1 + sitemap.xml | 193 + sitemap.xml.gz | Bin 0 -> 530 bytes src/docs/deployment.ipynb | 197 + static/css/badges.css | 49 + static/css/custom.css | 50 + static/css/global.css | 25 + static/css/home.css | 9 + static/css/tailwind.css | 949 +++ tailwind.css | 26 + utilities/chat_completion/index.html | 2349 ++++++ welcome/installation/index.html | 2093 +++++ welcome/overview/index.html | 2132 ++++++ welcome/quickstart/index.html | 2272 ++++++ welcome/what_is_marvin/index.html | 2077 +++++ 146 files changed, 96628 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 CNAME create mode 100644 __pycache__/hooks.cpython-39.pyc create mode 100644 api_reference/components/ai_application/index.html create mode 100644 api_reference/components/ai_classifier/index.html create mode 100644 api_reference/components/ai_function/index.html create mode 100644 api_reference/components/ai_model/index.html create mode 100644 api_reference/engine/language_models/anthropic/index.html create mode 100644 api_reference/engine/language_models/base/index.html create mode 100644 api_reference/engine/language_models/openai/index.html create mode 100644 api_reference/prompts/base/index.html create mode 100644 api_reference/prompts/library/index.html create mode 100644 api_reference/settings/index.html create mode 100644 api_reference/utilities/async_utils/index.html create mode 100644 api_reference/utilities/embeddings/index.html create mode 100644 api_reference/utilities/history/index.html create mode 100644 api_reference/utilities/logging/index.html create mode 100644 api_reference/utilities/messages/index.html create mode 100644 api_reference/utilities/strings/index.html create mode 100644 api_reference/utilities/types/index.html create mode 100644 assets/_mkdocstrings.css create mode 100644 assets/images/favicon.png create mode 100644 assets/images/social/api_reference/components/ai_application.png create mode 100644 assets/images/social/api_reference/components/ai_classifier.png create mode 100644 assets/images/social/api_reference/components/ai_function.png create mode 100644 assets/images/social/api_reference/components/ai_model.png create mode 100644 assets/images/social/api_reference/engine/language_models/anthropic.png create mode 100644 assets/images/social/api_reference/engine/language_models/base.png create mode 100644 assets/images/social/api_reference/engine/language_models/openai.png create mode 100644 assets/images/social/api_reference/prompts/base.png create mode 100644 assets/images/social/api_reference/prompts/library.png create mode 100644 assets/images/social/api_reference/settings.png create mode 100644 assets/images/social/api_reference/utilities/async_utils.png create mode 100644 assets/images/social/api_reference/utilities/embeddings.png create mode 100644 assets/images/social/api_reference/utilities/history.png create mode 100644 assets/images/social/api_reference/utilities/logging.png create mode 100644 assets/images/social/api_reference/utilities/messages.png create mode 100644 assets/images/social/api_reference/utilities/strings.png create mode 100644 assets/images/social/api_reference/utilities/types.png create mode 100644 assets/images/social/community/development_guide.png create mode 100644 assets/images/social/community/feedback.png create mode 100644 assets/images/social/community/index.png create mode 100644 assets/images/social/components/ai_application.png create mode 100644 assets/images/social/components/ai_classifier.png create mode 100644 assets/images/social/components/ai_function.png create mode 100644 assets/images/social/components/ai_model.png create mode 100644 assets/images/social/components/overview.png create mode 100644 assets/images/social/configuration/providers.png create mode 100644 assets/images/social/configuration/settings.png create mode 100644 assets/images/social/deployment/index.png create mode 100644 assets/images/social/examples/github_digest.png create mode 100644 assets/images/social/examples/slackbot.png create mode 100644 assets/images/social/index.png create mode 100644 assets/images/social/llms/llms.png create mode 100644 assets/images/social/llms/prompt.png create mode 100644 assets/images/social/utilities/chat_completion.png create mode 100644 assets/images/social/welcome/installation.png create mode 100644 assets/images/social/welcome/overview.png create mode 100644 assets/images/social/welcome/quickstart.png create mode 100644 assets/images/social/welcome/what_is_marvin.png create mode 100644 assets/javascripts/bundle.78eede0e.min.js create mode 100644 assets/javascripts/bundle.78eede0e.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.dfff1995.min.js create mode 100644 assets/javascripts/workers/search.dfff1995.min.js.map create mode 100644 assets/stylesheets/main.0e669242.min.css create mode 100644 assets/stylesheets/main.0e669242.min.css.map create mode 100644 assets/stylesheets/palette.85d0ee34.min.css create mode 100644 assets/stylesheets/palette.85d0ee34.min.css.map create mode 100644 community/development_guide/index.html create mode 100644 community/feedback/index.html create mode 100644 community/index.html create mode 100644 components/ai_application/index.html create mode 100644 components/ai_classifier/index.html create mode 100644 components/ai_function/index.html create mode 100644 components/ai_model/index.html create mode 100644 components/overview/index.html create mode 100644 configuration/providers/index.html create mode 100644 configuration/settings/index.html create mode 100644 deployment/index.html create mode 100644 examples/github_digest/index.html create mode 100644 examples/slackbot/index.html create mode 100644 hooks.py create mode 100644 img/heroes/ai_model.png create mode 100644 img/heroes/dont_panic.png create mode 100644 img/heroes/it_hates_me_hero.png create mode 100644 img/heroes/life_the_universe_and_ai.png create mode 100644 img/heroes/pip_install_marvin_hero.png create mode 100644 img/heroes/sort_of_thing_you_enjoy.png create mode 100644 img/logos/askmarvin_mascot.jpeg create mode 100644 index.html create mode 100644 llms/llms/index.html create mode 100644 llms/prompt/index.html create mode 100644 objects.inv create mode 100644 overrides/home.html create mode 100644 overrides/partials/footer.html create mode 100644 overrides/partials/grid.html create mode 100644 overrides/tailwind.css create mode 100644 search/search_index.json create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz create mode 100644 src/docs/deployment.ipynb create mode 100644 static/css/badges.css create mode 100644 static/css/custom.css create mode 100644 static/css/global.css create mode 100644 static/css/home.css create mode 100644 static/css/tailwind.css create mode 100644 tailwind.css create mode 100644 utilities/chat_completion/index.html create mode 100644 welcome/installation/index.html create mode 100644 welcome/overview/index.html create mode 100644 welcome/quickstart/index.html create mode 100644 welcome/what_is_marvin/index.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/404.html b/404.html new file mode 100644 index 000000000..9945ba3d2 --- /dev/null +++ b/404.html @@ -0,0 +1,1928 @@ + + + +
+ + + + + + + + + + + + + + + + +marvin.components.ai_application
+
+
+¶AIApplication
+
+
+¶An AI application is a stateful, autonomous, natural language + interface to an application.
+ + + +Attributes:
+Name | +Type | +Description | +
---|---|---|
name |
+
+ str
+ |
+
+
+
+ The name of the application. + |
+
description |
+
+ str
+ |
+
+
+
+ A description of the application. + |
+
state |
+
+ BaseModel
+ |
+
+
+
+ The application's state - this can be any JSON-serializable object. + |
+
plan |
+
+ AppPlan
+ |
+
+
+
+ The AI's plan in service of the application - this can be any +JSON-serializable object. + |
+
tools |
+
+ list[Union[Tool, Callable]]
+ |
+
+
+
+ A list of tools that the AI can use to interact with +application or outside world. + |
+
history |
+
+ History
+ |
+
+
+
+ A history of all messages sent and received by the AI. + |
+
additional_prompts |
+
+ list[Prompt]
+ |
+
+
+
+ A list of additional prompts that will be +added to the prompt stack for rendering. + |
+
Create a simple todo app where AI manages its own state and plan. +
+AppPlan
+
+
+¶The AI's plan in service of the application.
+ + + +Attributes:
+Name | +Type | +Description | +
---|---|---|
tasks |
+
+ list[Task]
+ |
+
+
+
+ A list of tasks the AI is working on. + |
+
notes |
+
+ list[str]
+ |
+
+
+
+ A list of notes the AI has taken. + |
+
FreeformState
+
+
+¶A freeform state object that can be used to store any JSON-serializable data.
+ + + +Attributes:
+Name | +Type | +Description | +
---|---|---|
state |
+
+ dict[str, Any]
+ |
+
+
+
+ The state object. + |
+
JSONPatchModel
+
+
+¶A JSON Patch document.
+ + + +Attributes:
+Name | +Type | +Description | +
---|---|---|
op |
+
+ str
+ |
+
+
+
+ The operation to perform. + |
+
path |
+
+ str
+ |
+
+
+
+ The path to the value to update. + |
+
value |
+
+ Union[str, float, int, bool, list, dict]
+ |
+
+
+
+ The value to update the path to. + |
+
from_ |
+
+ str
+ |
+
+
+
+ The path to the value to copy from. + |
+
TaskState
+
+
+¶The state of a task.
+ + + +Attributes:
+Name | +Type | +Description | +
---|---|---|
PENDING |
+ + | +
+
+
+ The task is pending and has not yet started. + |
+
IN_PROGRESS |
+ + | +
+
+
+ The task is in progress. + |
+
COMPLETED |
+ + | +
+
+
+ The task is completed. + |
+
FAILED |
+ + | +
+
+
+ The task failed. + |
+
SKIPPED |
+ + | +
+
+
+ The task was skipped. + |
+
UpdatePlan
+
+
+¶A Tool
that updates the apps plan using JSON Patch documents.
Manually update task status in an AI Application's plan. +
from marvin.components.ai_application import (
+ AIApplication,
+ AppPlan,
+ JSONPatchModel,
+ UpdatePlan,
+)
+
+todo_app = AIApplication(name="Todo App", description="A simple todo app")
+
+todo_app("i need to buy milk")
+
+# manually update the plan (usually done by the AI)
+patch = JSONPatchModel(
+ op="replace",
+ path="/tasks/0/state",
+ value="COMPLETED"
+)
+
+UpdatePlan(app=todo_app).run([patch.dict()])
+
+print(todo_app.plan)
+
UpdateState
+
+
+¶A Tool
that updates the apps state using JSON Patch documents.
Manually update the state of an AI Application. +
from marvin.components.ai_application import (
+ AIApplication,
+ FreeformState,
+ JSONPatchModel,
+ UpdateState,
+)
+
+destination_tracker = AIApplication(
+ name="Destination Tracker",
+ description="keeps track of where i've been",
+ state=FreeformState(state={"San Francisco": "not visited"}),
+)
+
+patch = JSONPatchModel(
+ op="replace", path="/state/San Francisco", value="visited"
+)
+
+UpdateState(app=destination_tracker).run([patch.dict()])
+
+assert destination_tracker.state.dict() == {
+ "state": {"San Francisco": "visited"}
+}
+
marvin.components.ai_classifier
+
+
+¶AIEnum
+
+
+¶AIEnum is a class that extends Python's built-in Enum class. +It uses the AIEnumMeta metaclass, which allows additional parameters to be passed +when creating an enum. These parameters are used to customize the behavior +of the AI classifier.
+ + + + +map
+
+
+ classmethod
+
+
+¶Map the classifier over a list of items.
+ +AIEnumMeta
+
+
+¶A metaclass for the AIEnum class: extends the functionality of EnumMeta +the metaclass for Python's built-in Enum class, allows additional params to be +passed when creating an enum. These parameters are used to customize the behavior +of the AI classifier.
+ + + + +ai_classifier
+
+¶A decorator that transforms a regular Enum class into an AIEnum class. It adds +additional attributes and methods to the class that are used to customize the +behavior of the AI classifier.
+ +marvin.components.ai_function
+
+
+¶AIFunction
+
+
+¶map
+
+¶Map the AI function over a sequence of arguments. Runs concurrently.
+Arguments should be provided as if calling the function normally, but +each argument must be a list. The function is called once for each item +in the list, and the results are returned in a list.
+This method should be called synchronously.
+For example, fn.map([1, 2]) is equivalent to [fn(1), fn(2)].
+fn.map([1, 2], x=['a', 'b']) is equivalent to [fn(1, x='a'), fn(2, x='b')].
+ +marvin.components.ai_model
+
+
+¶AIModel
+
+
+¶Base class for AI models.
+ + + + +amap
+
+
+ async
+ classmethod
+
+
+¶Map the AI model over a sequence of arguments. Runs concurrently +and must be awaited.
+ +extract
+
+
+ classmethod
+
+
+¶Class method to extract structured data from text.
+ + + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
text_ |
+
+ str
+ |
+
+
+
+ The text to parse into a structured form. + |
+
+ None
+ |
+
instructions_ |
+
+ str
+ |
+
+
+
+ Additional string instructions to assist the model. + |
+
+ None
+ |
+
model_ |
+
+ ChatLLM
+ |
+
+
+
+ The language model to use. + |
+
+ None
+ |
+
as_dict_ |
+
+ bool
+ |
+
+
+
+ Whether to return the result as a dictionary or as an +instance of this class. + |
+
+ False
+ |
+
kwargs |
+ + | +
+
+
+ Additional keyword arguments to pass to the constructor. + |
+
+ {}
+ |
+
generate
+
+
+ classmethod
+
+
+¶Class method to generate structured data from text.
+ + + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
text_ |
+
+ str
+ |
+
+
+
+ The text to parse into a structured form. + |
+
+ None
+ |
+
instructions_ |
+
+ str
+ |
+
+
+
+ Additional instructions to assist the model. + |
+
+ None
+ |
+
model_ |
+
+ ChatLLM
+ |
+
+
+
+ The language model to use. + |
+
+ None
+ |
+
as_dict_ |
+
+ bool
+ |
+
+
+
+ Whether to return the result as a dictionary or as an +instance of this class. + |
+
+ False
+ |
+
kwargs |
+ + | +
+
+
+ Additional keyword arguments to pass to the constructor. + |
+
+ {}
+ |
+
map
+
+
+ classmethod
+
+
+¶Map the AI model over a sequence of arguments. Runs concurrently +and is called synchronously.
+ + +ai_model
+
+¶Decorator to add AI model functionality to a class.
+ + + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
cls |
+
+ Optional[Type[T]]
+ |
+
+
+
+ The class to decorate. + |
+
+ None
+ |
+
instructions |
+
+ str
+ |
+
+
+
+ Instructions to guide the model's behavior. This can also +be set on a per-call basis, in which the per-call instructions are +appended to these instructions. + |
+
+ None
+ |
+
model |
+
+ ChatLLM
+ |
+
+
+
+ The language model to use. This can also be set on a per-call +basis, in which case the per-call model overwrites this model. + |
+
+ None
+ |
+
Hydrate a class schema from a natural language description: +
from pydantic import BaseModel
+from marvin import ai_model
+
+@ai_model
+class Location(BaseModel):
+ city: str
+ state: str
+ latitude: float
+ longitude: float
+
+Location("no way, I also live in the windy city")
+# Location(
+# city='Chicago', state='Illinois', latitude=41.8781, longitude=-87.6298
+# )
+
marvin.engine.language_models.anthropic
+
+
+¶marvin.engine.language_models.base
+
+
+¶ChatLLM
+
+
+¶format_messages
+
+
+ abstractmethod
+
+
+¶Format Marvin message objects into a prompt compatible with the LLM model
+ +run
+
+
+ abstractmethod
+ async
+
+
+¶Run the LLM model on a list of messages and optional list of functions
+ +OpenAIFunction
+
+
+¶args: dict = None
+
+
+ class-attribute
+ instance-attribute
+
+
+¶Base class for representing a function that can be called by an LLM. The +format is identical to OpenAI's Functions API.
+ + + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
name |
+
+ str
+ |
+
+
+
+ The name of the function. description (str): The description + |
+ + required + | +
of |
+
+ the function. parameters (dict
+ |
+
+
+
+ The parameters of the function. fn + |
+ + required + | +
(Callable) |
+ + | +
+
+
+ The function to be called. args (dict): The arguments to be + |
+ + required + | +
chat_llm
+
+¶Dispatches to all supported LLM providers
+ +marvin.prompts.base
+
+
+¶marvin.prompts.library
+
+
+¶MessagePrompt
+
+
+¶get_content
+
+¶Override this method to easily customize behavior
+ +Tagged
+
+
+¶Surround content with a tag, e.g. bold
+ + + + +marvin.settings
+
+
+¶OpenAISettings
+
+
+¶Provider-specific settings. Only some of these will be relevant to users.
+ + + + +Settings
+
+
+¶Marvin settings
+ + + + +temporary_settings
+
+¶Temporarily override Marvin setting values. This will not mutate values that have +been already been accessed at module load time.
+This function should only be used for testing.
+ +++++++from marvin.settings import settings +with temporary_settings(MARVIN_LLM_MAX_TOKENS=100): + assert settings.llm_max_tokens == 100 +assert settings.llm_max_tokens == 1500
+
marvin.utilities.async_utils
+
+
+¶create_task
+
+¶Creates async background tasks in a way that is safe from garbage +collection.
+See +https://textual.textualize.io/blog/2023/02/11/the-heisenbug-lurking-in-your-async-code/
+Example:
+async def my_coro(x: int) -> int: + return x + 1
+create_task(my_coro(1))
+ +run_async
+
+
+ async
+
+
+¶Runs a synchronous function in an asynchronous manner.
+ +run_sync
+
+¶Runs a coroutine from a synchronous context, either in the current event +loop or in a new one if there is no event loop running. The coroutine will +block until it is done. A thread will be spawned to run the event loop if +necessary, which allows coroutines to run in environments like Jupyter +notebooks where the event loop runs on the main thread.
+ +marvin.utilities.history
+
+
+¶marvin.utilities.logging
+
+
+¶marvin.utilities.messages
+
+
+¶marvin.utilities.types
+
+
+¶LoggerMixin
+
+
+¶BaseModel mixin that adds a private logger
attribute
function_to_model
+
+¶Converts a function's arguments into an OpenAPI schema by parsing it into a +Pydantic model. To work, all arguments must have valid type annotations.
+ +function_to_schema
+
+¶Converts a function's arguments into an OpenAPI schema by parsing it into a +Pydantic model. To work, all arguments must have valid type annotations.
+ +genericalias_contains
+
+¶Explore whether a type or generic alias contains a target type. The target +types can be a single type or a tuple of types.
+Useful for seeing if a type contains a pydantic model, for example.
+ +8^(qJNo0IP;DayfH|!Vs{k
zUSONPRV4xwsS$`tZ;9JUZHa@(E?f`_3dveKTHu6l9jR42wqGe|Poj4BZC22w{#*Hi
zbEhPyq&$SF(v08Hy?6$hg7etGcc6@_MC9XxzH; olu;#N!Ogjq=G3 VL0~L}_39ZMoO3SOcysa}Mc=e+(P6HEOX;4aLC4gvw#V#E^aA
zX>xkHEvfROp4_~Kewdf2D1T=+SnKA!Anh;o+7Tl@+Z4b`!*9xVPNIB)h)CcMXk)tEODXwdnM
zYd&e&?(GwzCxr_jpZp3sUx4p++r3`YpMD>9S%#ZLC|y{uzKFgRZ|TX@uu9qPOf~b|
z>%wnZ0d=x$Fb2Bx5oGBI%$^N1iKGSI1v2+x*=UKBA--c^Ofz`)t?kYLo`7K`jwf27
zf|ja3hx4u*i+ZwvwZEFjpItLNL9A~>-Du96P`298%aMWR*=O}2jSr0Y0#cIlt8dea
z)j-m}xa{6tup&&C+E(GUuY5SMsLtek?x~yUyM@p`-
e(Z^p%yl4Ta6onYFX+g6pa_pK*C*v?hhVn&s3%!hO1DMrzzu4UB#!#VJyykXt$EQ
zNnO>nJ?Qv$YtnWSYX2TL?rcznDJh@i@PtrXT<@`#z%Qwtv;g&+Ls
z_Q`W6B;+CNq+_0jJXU&HrHUXh8y)4OVD*UjN%glK$x-tK6XYj4N{IEFa^GHhjObVv
z=XKF$Jr(Zc-_h36^1?eFmauX!r>ub^f)?I80_){BKUIg1+@nD$yO7@x|rkz)iq8`Fm$Gr
zdJQ^I79TAe08=ICBb7%@{D`)JNF69dOG__D2ckt_o=ena1a(D(*4m-OD-CX&%G%E3
z5^NY*5gj}s$$K=sRN~@