mirascope 1.25.7__py3-none-any.whl → 2.0.0a0__py3-none-any.whl
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.
- mirascope/__init__.py +3 -59
- mirascope/graphs/__init__.py +22 -0
- mirascope/{experimental/graphs → graphs}/finite_state_machine.py +70 -159
- mirascope/llm/__init__.py +206 -16
- mirascope/llm/agents/__init__.py +15 -0
- mirascope/llm/agents/agent.py +97 -0
- mirascope/llm/agents/agent_template.py +45 -0
- mirascope/llm/agents/decorator.py +176 -0
- mirascope/llm/calls/__init__.py +16 -0
- mirascope/llm/calls/base_call.py +33 -0
- mirascope/llm/calls/calls.py +315 -0
- mirascope/llm/calls/decorator.py +255 -0
- mirascope/llm/clients/__init__.py +34 -0
- mirascope/llm/clients/anthropic/__init__.py +11 -0
- mirascope/llm/clients/anthropic/_utils/__init__.py +13 -0
- mirascope/llm/clients/anthropic/_utils/decode.py +244 -0
- mirascope/llm/clients/anthropic/_utils/encode.py +243 -0
- mirascope/llm/clients/anthropic/clients.py +819 -0
- mirascope/llm/clients/anthropic/model_ids.py +8 -0
- mirascope/llm/clients/base/__init__.py +15 -0
- mirascope/llm/clients/base/_utils.py +192 -0
- mirascope/llm/clients/base/client.py +1256 -0
- mirascope/llm/clients/base/kwargs.py +12 -0
- mirascope/llm/clients/base/params.py +93 -0
- mirascope/llm/clients/google/__init__.py +6 -0
- mirascope/llm/clients/google/_utils/__init__.py +13 -0
- mirascope/llm/clients/google/_utils/decode.py +231 -0
- mirascope/llm/clients/google/_utils/encode.py +279 -0
- mirascope/llm/clients/google/clients.py +853 -0
- mirascope/llm/clients/google/message.py +7 -0
- mirascope/llm/clients/google/model_ids.py +15 -0
- mirascope/llm/clients/openai/__init__.py +25 -0
- mirascope/llm/clients/openai/completions/__init__.py +9 -0
- mirascope/llm/clients/openai/completions/_utils/__init__.py +13 -0
- mirascope/llm/clients/openai/completions/_utils/decode.py +187 -0
- mirascope/llm/clients/openai/completions/_utils/encode.py +358 -0
- mirascope/llm/clients/openai/completions/_utils/model_features.py +81 -0
- mirascope/llm/clients/openai/completions/clients.py +833 -0
- mirascope/llm/clients/openai/completions/model_ids.py +8 -0
- mirascope/llm/clients/openai/responses/__init__.py +9 -0
- mirascope/llm/clients/openai/responses/_utils/__init__.py +13 -0
- mirascope/llm/clients/openai/responses/_utils/decode.py +194 -0
- mirascope/llm/clients/openai/responses/_utils/encode.py +333 -0
- mirascope/llm/clients/openai/responses/_utils/model_features.py +87 -0
- mirascope/llm/clients/openai/responses/clients.py +832 -0
- mirascope/llm/clients/openai/responses/model_ids.py +8 -0
- mirascope/llm/clients/openai/shared/__init__.py +7 -0
- mirascope/llm/clients/openai/shared/_utils.py +55 -0
- mirascope/llm/clients/providers.py +175 -0
- mirascope/llm/content/__init__.py +70 -0
- mirascope/llm/content/audio.py +173 -0
- mirascope/llm/content/document.py +94 -0
- mirascope/llm/content/image.py +206 -0
- mirascope/llm/content/text.py +47 -0
- mirascope/llm/content/thought.py +58 -0
- mirascope/llm/content/tool_call.py +63 -0
- mirascope/llm/content/tool_output.py +26 -0
- mirascope/llm/context/__init__.py +6 -0
- mirascope/llm/context/_utils.py +28 -0
- mirascope/llm/context/context.py +24 -0
- mirascope/llm/exceptions.py +105 -0
- mirascope/llm/formatting/__init__.py +22 -0
- mirascope/llm/formatting/_utils.py +74 -0
- mirascope/llm/formatting/format.py +104 -0
- mirascope/llm/formatting/from_call_args.py +30 -0
- mirascope/llm/formatting/partial.py +58 -0
- mirascope/llm/formatting/types.py +109 -0
- mirascope/llm/mcp/__init__.py +5 -0
- mirascope/llm/mcp/client.py +118 -0
- mirascope/llm/messages/__init__.py +32 -0
- mirascope/llm/messages/message.py +182 -0
- mirascope/llm/models/__init__.py +16 -0
- mirascope/llm/models/models.py +1243 -0
- mirascope/llm/prompts/__init__.py +33 -0
- mirascope/llm/prompts/_utils.py +60 -0
- mirascope/llm/prompts/decorator.py +286 -0
- mirascope/llm/prompts/protocols.py +99 -0
- mirascope/llm/responses/__init__.py +57 -0
- mirascope/llm/responses/_utils.py +56 -0
- mirascope/llm/responses/base_response.py +91 -0
- mirascope/llm/responses/base_stream_response.py +697 -0
- mirascope/llm/responses/finish_reason.py +27 -0
- mirascope/llm/responses/response.py +345 -0
- mirascope/llm/responses/root_response.py +177 -0
- mirascope/llm/responses/stream_response.py +572 -0
- mirascope/llm/responses/streams.py +363 -0
- mirascope/llm/tools/__init__.py +40 -0
- mirascope/llm/tools/_utils.py +25 -0
- mirascope/llm/tools/decorator.py +175 -0
- mirascope/llm/tools/protocols.py +96 -0
- mirascope/llm/tools/tool_schema.py +246 -0
- mirascope/llm/tools/toolkit.py +152 -0
- mirascope/llm/tools/tools.py +169 -0
- mirascope/llm/types/__init__.py +22 -0
- mirascope/llm/types/dataclass.py +9 -0
- mirascope/llm/types/jsonable.py +44 -0
- mirascope/llm/types/type_vars.py +19 -0
- mirascope-2.0.0a0.dist-info/METADATA +117 -0
- mirascope-2.0.0a0.dist-info/RECORD +101 -0
- mirascope/beta/__init__.py +0 -3
- mirascope/beta/openai/__init__.py +0 -17
- mirascope/beta/openai/realtime/__init__.py +0 -13
- mirascope/beta/openai/realtime/_utils/__init__.py +0 -3
- mirascope/beta/openai/realtime/_utils/_audio.py +0 -74
- mirascope/beta/openai/realtime/_utils/_protocols.py +0 -50
- mirascope/beta/openai/realtime/realtime.py +0 -500
- mirascope/beta/openai/realtime/recording.py +0 -98
- mirascope/beta/openai/realtime/tool.py +0 -113
- mirascope/beta/rag/__init__.py +0 -24
- mirascope/beta/rag/base/__init__.py +0 -22
- mirascope/beta/rag/base/chunkers/__init__.py +0 -2
- mirascope/beta/rag/base/chunkers/base_chunker.py +0 -37
- mirascope/beta/rag/base/chunkers/text_chunker.py +0 -33
- mirascope/beta/rag/base/config.py +0 -8
- mirascope/beta/rag/base/document.py +0 -11
- mirascope/beta/rag/base/embedders.py +0 -35
- mirascope/beta/rag/base/embedding_params.py +0 -18
- mirascope/beta/rag/base/embedding_response.py +0 -30
- mirascope/beta/rag/base/query_results.py +0 -7
- mirascope/beta/rag/base/vectorstore_params.py +0 -18
- mirascope/beta/rag/base/vectorstores.py +0 -37
- mirascope/beta/rag/chroma/__init__.py +0 -11
- mirascope/beta/rag/chroma/types.py +0 -62
- mirascope/beta/rag/chroma/vectorstores.py +0 -121
- mirascope/beta/rag/cohere/__init__.py +0 -11
- mirascope/beta/rag/cohere/embedders.py +0 -87
- mirascope/beta/rag/cohere/embedding_params.py +0 -29
- mirascope/beta/rag/cohere/embedding_response.py +0 -29
- mirascope/beta/rag/cohere/py.typed +0 -0
- mirascope/beta/rag/openai/__init__.py +0 -11
- mirascope/beta/rag/openai/embedders.py +0 -144
- mirascope/beta/rag/openai/embedding_params.py +0 -18
- mirascope/beta/rag/openai/embedding_response.py +0 -14
- mirascope/beta/rag/openai/py.typed +0 -0
- mirascope/beta/rag/pinecone/__init__.py +0 -19
- mirascope/beta/rag/pinecone/types.py +0 -143
- mirascope/beta/rag/pinecone/vectorstores.py +0 -148
- mirascope/beta/rag/weaviate/__init__.py +0 -6
- mirascope/beta/rag/weaviate/types.py +0 -92
- mirascope/beta/rag/weaviate/vectorstores.py +0 -103
- mirascope/core/__init__.py +0 -109
- mirascope/core/anthropic/__init__.py +0 -31
- mirascope/core/anthropic/_call.py +0 -67
- mirascope/core/anthropic/_call_kwargs.py +0 -13
- mirascope/core/anthropic/_thinking.py +0 -70
- mirascope/core/anthropic/_utils/__init__.py +0 -16
- mirascope/core/anthropic/_utils/_convert_common_call_params.py +0 -25
- mirascope/core/anthropic/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -21
- mirascope/core/anthropic/_utils/_convert_message_params.py +0 -102
- mirascope/core/anthropic/_utils/_get_json_output.py +0 -31
- mirascope/core/anthropic/_utils/_handle_stream.py +0 -113
- mirascope/core/anthropic/_utils/_message_param_converter.py +0 -154
- mirascope/core/anthropic/_utils/_setup_call.py +0 -146
- mirascope/core/anthropic/call_params.py +0 -44
- mirascope/core/anthropic/call_response.py +0 -226
- mirascope/core/anthropic/call_response_chunk.py +0 -152
- mirascope/core/anthropic/dynamic_config.py +0 -40
- mirascope/core/anthropic/py.typed +0 -0
- mirascope/core/anthropic/stream.py +0 -204
- mirascope/core/anthropic/tool.py +0 -101
- mirascope/core/azure/__init__.py +0 -31
- mirascope/core/azure/_call.py +0 -67
- mirascope/core/azure/_call_kwargs.py +0 -13
- mirascope/core/azure/_utils/__init__.py +0 -14
- mirascope/core/azure/_utils/_convert_common_call_params.py +0 -26
- mirascope/core/azure/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -21
- mirascope/core/azure/_utils/_convert_message_params.py +0 -121
- mirascope/core/azure/_utils/_get_credential.py +0 -33
- mirascope/core/azure/_utils/_get_json_output.py +0 -27
- mirascope/core/azure/_utils/_handle_stream.py +0 -130
- mirascope/core/azure/_utils/_message_param_converter.py +0 -117
- mirascope/core/azure/_utils/_setup_call.py +0 -183
- mirascope/core/azure/call_params.py +0 -59
- mirascope/core/azure/call_response.py +0 -215
- mirascope/core/azure/call_response_chunk.py +0 -105
- mirascope/core/azure/dynamic_config.py +0 -30
- mirascope/core/azure/py.typed +0 -0
- mirascope/core/azure/stream.py +0 -147
- mirascope/core/azure/tool.py +0 -93
- mirascope/core/base/__init__.py +0 -86
- mirascope/core/base/_call_factory.py +0 -256
- mirascope/core/base/_create.py +0 -253
- mirascope/core/base/_extract.py +0 -175
- mirascope/core/base/_extract_with_tools.py +0 -189
- mirascope/core/base/_partial.py +0 -95
- mirascope/core/base/_utils/__init__.py +0 -92
- mirascope/core/base/_utils/_base_message_param_converter.py +0 -22
- mirascope/core/base/_utils/_base_type.py +0 -26
- mirascope/core/base/_utils/_convert_base_model_to_base_tool.py +0 -48
- mirascope/core/base/_utils/_convert_base_type_to_base_tool.py +0 -24
- mirascope/core/base/_utils/_convert_function_to_base_tool.py +0 -139
- mirascope/core/base/_utils/_convert_messages_to_message_params.py +0 -178
- mirascope/core/base/_utils/_convert_provider_finish_reason_to_finish_reason.py +0 -20
- mirascope/core/base/_utils/_default_tool_docstring.py +0 -6
- mirascope/core/base/_utils/_extract_tool_return.py +0 -42
- mirascope/core/base/_utils/_fn_is_async.py +0 -24
- mirascope/core/base/_utils/_format_template.py +0 -32
- mirascope/core/base/_utils/_get_audio_type.py +0 -18
- mirascope/core/base/_utils/_get_common_usage.py +0 -20
- mirascope/core/base/_utils/_get_create_fn_or_async_create_fn.py +0 -137
- mirascope/core/base/_utils/_get_document_type.py +0 -7
- mirascope/core/base/_utils/_get_dynamic_configuration.py +0 -69
- mirascope/core/base/_utils/_get_fields_from_call_args.py +0 -34
- mirascope/core/base/_utils/_get_fn_args.py +0 -23
- mirascope/core/base/_utils/_get_image_dimensions.py +0 -39
- mirascope/core/base/_utils/_get_image_type.py +0 -26
- mirascope/core/base/_utils/_get_metadata.py +0 -17
- mirascope/core/base/_utils/_get_possible_user_message_param.py +0 -21
- mirascope/core/base/_utils/_get_prompt_template.py +0 -28
- mirascope/core/base/_utils/_get_template_values.py +0 -51
- mirascope/core/base/_utils/_get_template_variables.py +0 -38
- mirascope/core/base/_utils/_get_unsupported_tool_config_keys.py +0 -10
- mirascope/core/base/_utils/_is_prompt_template.py +0 -24
- mirascope/core/base/_utils/_json_mode_content.py +0 -17
- mirascope/core/base/_utils/_messages_decorator.py +0 -121
- mirascope/core/base/_utils/_parse_content_template.py +0 -323
- mirascope/core/base/_utils/_parse_prompt_messages.py +0 -63
- mirascope/core/base/_utils/_pil_image_to_bytes.py +0 -13
- mirascope/core/base/_utils/_protocols.py +0 -901
- mirascope/core/base/_utils/_setup_call.py +0 -79
- mirascope/core/base/_utils/_setup_extract_tool.py +0 -30
- mirascope/core/base/call_kwargs.py +0 -13
- mirascope/core/base/call_params.py +0 -36
- mirascope/core/base/call_response.py +0 -338
- mirascope/core/base/call_response_chunk.py +0 -130
- mirascope/core/base/dynamic_config.py +0 -82
- mirascope/core/base/from_call_args.py +0 -30
- mirascope/core/base/merge_decorators.py +0 -59
- mirascope/core/base/message_param.py +0 -175
- mirascope/core/base/messages.py +0 -116
- mirascope/core/base/metadata.py +0 -13
- mirascope/core/base/prompt.py +0 -497
- mirascope/core/base/response_model_config_dict.py +0 -9
- mirascope/core/base/stream.py +0 -479
- mirascope/core/base/stream_config.py +0 -11
- mirascope/core/base/structured_stream.py +0 -296
- mirascope/core/base/tool.py +0 -214
- mirascope/core/base/toolkit.py +0 -176
- mirascope/core/base/types.py +0 -344
- mirascope/core/bedrock/__init__.py +0 -34
- mirascope/core/bedrock/_call.py +0 -68
- mirascope/core/bedrock/_call_kwargs.py +0 -12
- mirascope/core/bedrock/_types.py +0 -104
- mirascope/core/bedrock/_utils/__init__.py +0 -14
- mirascope/core/bedrock/_utils/_convert_common_call_params.py +0 -39
- mirascope/core/bedrock/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -23
- mirascope/core/bedrock/_utils/_convert_message_params.py +0 -111
- mirascope/core/bedrock/_utils/_get_json_output.py +0 -30
- mirascope/core/bedrock/_utils/_handle_stream.py +0 -104
- mirascope/core/bedrock/_utils/_message_param_converter.py +0 -172
- mirascope/core/bedrock/_utils/_setup_call.py +0 -258
- mirascope/core/bedrock/call_params.py +0 -38
- mirascope/core/bedrock/call_response.py +0 -248
- mirascope/core/bedrock/call_response_chunk.py +0 -111
- mirascope/core/bedrock/dynamic_config.py +0 -37
- mirascope/core/bedrock/py.typed +0 -0
- mirascope/core/bedrock/stream.py +0 -154
- mirascope/core/bedrock/tool.py +0 -100
- mirascope/core/cohere/__init__.py +0 -30
- mirascope/core/cohere/_call.py +0 -67
- mirascope/core/cohere/_call_kwargs.py +0 -11
- mirascope/core/cohere/_types.py +0 -20
- mirascope/core/cohere/_utils/__init__.py +0 -14
- mirascope/core/cohere/_utils/_convert_common_call_params.py +0 -26
- mirascope/core/cohere/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -24
- mirascope/core/cohere/_utils/_convert_message_params.py +0 -32
- mirascope/core/cohere/_utils/_get_json_output.py +0 -30
- mirascope/core/cohere/_utils/_handle_stream.py +0 -35
- mirascope/core/cohere/_utils/_message_param_converter.py +0 -54
- mirascope/core/cohere/_utils/_setup_call.py +0 -150
- mirascope/core/cohere/call_params.py +0 -62
- mirascope/core/cohere/call_response.py +0 -205
- mirascope/core/cohere/call_response_chunk.py +0 -125
- mirascope/core/cohere/dynamic_config.py +0 -32
- mirascope/core/cohere/py.typed +0 -0
- mirascope/core/cohere/stream.py +0 -113
- mirascope/core/cohere/tool.py +0 -93
- mirascope/core/costs/__init__.py +0 -5
- mirascope/core/costs/_anthropic_calculate_cost.py +0 -219
- mirascope/core/costs/_azure_calculate_cost.py +0 -11
- mirascope/core/costs/_bedrock_calculate_cost.py +0 -15
- mirascope/core/costs/_cohere_calculate_cost.py +0 -44
- mirascope/core/costs/_gemini_calculate_cost.py +0 -67
- mirascope/core/costs/_google_calculate_cost.py +0 -427
- mirascope/core/costs/_groq_calculate_cost.py +0 -156
- mirascope/core/costs/_litellm_calculate_cost.py +0 -11
- mirascope/core/costs/_mistral_calculate_cost.py +0 -64
- mirascope/core/costs/_openai_calculate_cost.py +0 -416
- mirascope/core/costs/_vertex_calculate_cost.py +0 -67
- mirascope/core/costs/_xai_calculate_cost.py +0 -104
- mirascope/core/costs/calculate_cost.py +0 -86
- mirascope/core/gemini/__init__.py +0 -40
- mirascope/core/gemini/_call.py +0 -67
- mirascope/core/gemini/_call_kwargs.py +0 -12
- mirascope/core/gemini/_utils/__init__.py +0 -14
- mirascope/core/gemini/_utils/_convert_common_call_params.py +0 -39
- mirascope/core/gemini/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -23
- mirascope/core/gemini/_utils/_convert_message_params.py +0 -156
- mirascope/core/gemini/_utils/_get_json_output.py +0 -35
- mirascope/core/gemini/_utils/_handle_stream.py +0 -33
- mirascope/core/gemini/_utils/_message_param_converter.py +0 -209
- mirascope/core/gemini/_utils/_setup_call.py +0 -149
- mirascope/core/gemini/call_params.py +0 -52
- mirascope/core/gemini/call_response.py +0 -216
- mirascope/core/gemini/call_response_chunk.py +0 -100
- mirascope/core/gemini/dynamic_config.py +0 -26
- mirascope/core/gemini/stream.py +0 -120
- mirascope/core/gemini/tool.py +0 -104
- mirascope/core/google/__init__.py +0 -29
- mirascope/core/google/_call.py +0 -67
- mirascope/core/google/_call_kwargs.py +0 -13
- mirascope/core/google/_utils/__init__.py +0 -14
- mirascope/core/google/_utils/_convert_common_call_params.py +0 -38
- mirascope/core/google/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -27
- mirascope/core/google/_utils/_convert_message_params.py +0 -297
- mirascope/core/google/_utils/_get_json_output.py +0 -37
- mirascope/core/google/_utils/_handle_stream.py +0 -58
- mirascope/core/google/_utils/_message_param_converter.py +0 -200
- mirascope/core/google/_utils/_setup_call.py +0 -201
- mirascope/core/google/_utils/_validate_media_type.py +0 -58
- mirascope/core/google/call_params.py +0 -22
- mirascope/core/google/call_response.py +0 -255
- mirascope/core/google/call_response_chunk.py +0 -135
- mirascope/core/google/dynamic_config.py +0 -26
- mirascope/core/google/stream.py +0 -199
- mirascope/core/google/tool.py +0 -146
- mirascope/core/groq/__init__.py +0 -30
- mirascope/core/groq/_call.py +0 -67
- mirascope/core/groq/_call_kwargs.py +0 -13
- mirascope/core/groq/_utils/__init__.py +0 -14
- mirascope/core/groq/_utils/_convert_common_call_params.py +0 -26
- mirascope/core/groq/_utils/_convert_message_params.py +0 -112
- mirascope/core/groq/_utils/_get_json_output.py +0 -27
- mirascope/core/groq/_utils/_handle_stream.py +0 -123
- mirascope/core/groq/_utils/_message_param_converter.py +0 -89
- mirascope/core/groq/_utils/_setup_call.py +0 -132
- mirascope/core/groq/call_params.py +0 -52
- mirascope/core/groq/call_response.py +0 -213
- mirascope/core/groq/call_response_chunk.py +0 -104
- mirascope/core/groq/dynamic_config.py +0 -29
- mirascope/core/groq/py.typed +0 -0
- mirascope/core/groq/stream.py +0 -135
- mirascope/core/groq/tool.py +0 -80
- mirascope/core/litellm/__init__.py +0 -28
- mirascope/core/litellm/_call.py +0 -67
- mirascope/core/litellm/_utils/__init__.py +0 -5
- mirascope/core/litellm/_utils/_setup_call.py +0 -109
- mirascope/core/litellm/call_params.py +0 -10
- mirascope/core/litellm/call_response.py +0 -24
- mirascope/core/litellm/call_response_chunk.py +0 -14
- mirascope/core/litellm/dynamic_config.py +0 -8
- mirascope/core/litellm/py.typed +0 -0
- mirascope/core/litellm/stream.py +0 -86
- mirascope/core/litellm/tool.py +0 -13
- mirascope/core/mistral/__init__.py +0 -36
- mirascope/core/mistral/_call.py +0 -65
- mirascope/core/mistral/_call_kwargs.py +0 -19
- mirascope/core/mistral/_utils/__init__.py +0 -14
- mirascope/core/mistral/_utils/_convert_common_call_params.py +0 -24
- mirascope/core/mistral/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -22
- mirascope/core/mistral/_utils/_convert_message_params.py +0 -122
- mirascope/core/mistral/_utils/_get_json_output.py +0 -34
- mirascope/core/mistral/_utils/_handle_stream.py +0 -139
- mirascope/core/mistral/_utils/_message_param_converter.py +0 -176
- mirascope/core/mistral/_utils/_setup_call.py +0 -164
- mirascope/core/mistral/call_params.py +0 -36
- mirascope/core/mistral/call_response.py +0 -205
- mirascope/core/mistral/call_response_chunk.py +0 -105
- mirascope/core/mistral/dynamic_config.py +0 -33
- mirascope/core/mistral/py.typed +0 -0
- mirascope/core/mistral/stream.py +0 -120
- mirascope/core/mistral/tool.py +0 -81
- mirascope/core/openai/__init__.py +0 -31
- mirascope/core/openai/_call.py +0 -67
- mirascope/core/openai/_call_kwargs.py +0 -13
- mirascope/core/openai/_utils/__init__.py +0 -14
- mirascope/core/openai/_utils/_convert_common_call_params.py +0 -26
- mirascope/core/openai/_utils/_convert_message_params.py +0 -148
- mirascope/core/openai/_utils/_get_json_output.py +0 -31
- mirascope/core/openai/_utils/_handle_stream.py +0 -138
- mirascope/core/openai/_utils/_message_param_converter.py +0 -105
- mirascope/core/openai/_utils/_setup_call.py +0 -155
- mirascope/core/openai/call_params.py +0 -92
- mirascope/core/openai/call_response.py +0 -273
- mirascope/core/openai/call_response_chunk.py +0 -139
- mirascope/core/openai/dynamic_config.py +0 -34
- mirascope/core/openai/py.typed +0 -0
- mirascope/core/openai/stream.py +0 -185
- mirascope/core/openai/tool.py +0 -101
- mirascope/core/py.typed +0 -0
- mirascope/core/vertex/__init__.py +0 -45
- mirascope/core/vertex/_call.py +0 -62
- mirascope/core/vertex/_call_kwargs.py +0 -12
- mirascope/core/vertex/_utils/__init__.py +0 -14
- mirascope/core/vertex/_utils/_convert_common_call_params.py +0 -37
- mirascope/core/vertex/_utils/_convert_finish_reason_to_common_finish_reasons.py +0 -23
- mirascope/core/vertex/_utils/_convert_message_params.py +0 -171
- mirascope/core/vertex/_utils/_get_json_output.py +0 -36
- mirascope/core/vertex/_utils/_handle_stream.py +0 -33
- mirascope/core/vertex/_utils/_message_param_converter.py +0 -133
- mirascope/core/vertex/_utils/_setup_call.py +0 -160
- mirascope/core/vertex/call_params.py +0 -24
- mirascope/core/vertex/call_response.py +0 -206
- mirascope/core/vertex/call_response_chunk.py +0 -99
- mirascope/core/vertex/dynamic_config.py +0 -28
- mirascope/core/vertex/stream.py +0 -119
- mirascope/core/vertex/tool.py +0 -101
- mirascope/core/xai/__init__.py +0 -28
- mirascope/core/xai/_call.py +0 -67
- mirascope/core/xai/_utils/__init__.py +0 -5
- mirascope/core/xai/_utils/_setup_call.py +0 -113
- mirascope/core/xai/call_params.py +0 -10
- mirascope/core/xai/call_response.py +0 -16
- mirascope/core/xai/call_response_chunk.py +0 -14
- mirascope/core/xai/dynamic_config.py +0 -8
- mirascope/core/xai/py.typed +0 -0
- mirascope/core/xai/stream.py +0 -57
- mirascope/core/xai/tool.py +0 -13
- mirascope/experimental/graphs/__init__.py +0 -5
- mirascope/integrations/__init__.py +0 -16
- mirascope/integrations/_middleware_factory.py +0 -403
- mirascope/integrations/langfuse/__init__.py +0 -3
- mirascope/integrations/langfuse/_utils.py +0 -114
- mirascope/integrations/langfuse/_with_langfuse.py +0 -70
- mirascope/integrations/logfire/__init__.py +0 -3
- mirascope/integrations/logfire/_utils.py +0 -225
- mirascope/integrations/logfire/_with_logfire.py +0 -63
- mirascope/integrations/otel/__init__.py +0 -10
- mirascope/integrations/otel/_utils.py +0 -270
- mirascope/integrations/otel/_with_hyperdx.py +0 -60
- mirascope/integrations/otel/_with_otel.py +0 -59
- mirascope/integrations/tenacity.py +0 -14
- mirascope/llm/_call.py +0 -401
- mirascope/llm/_context.py +0 -384
- mirascope/llm/_override.py +0 -3639
- mirascope/llm/_protocols.py +0 -500
- mirascope/llm/_response_metaclass.py +0 -31
- mirascope/llm/call_response.py +0 -158
- mirascope/llm/call_response_chunk.py +0 -66
- mirascope/llm/stream.py +0 -162
- mirascope/llm/tool.py +0 -64
- mirascope/mcp/__init__.py +0 -7
- mirascope/mcp/_utils.py +0 -288
- mirascope/mcp/client.py +0 -167
- mirascope/mcp/server.py +0 -356
- mirascope/mcp/tools.py +0 -110
- mirascope/py.typed +0 -0
- mirascope/retries/__init__.py +0 -11
- mirascope/retries/fallback.py +0 -131
- mirascope/retries/tenacity.py +0 -50
- mirascope/tools/__init__.py +0 -37
- mirascope/tools/base.py +0 -98
- mirascope/tools/system/__init__.py +0 -0
- mirascope/tools/system/_docker_operation.py +0 -166
- mirascope/tools/system/_file_system.py +0 -267
- mirascope/tools/web/__init__.py +0 -0
- mirascope/tools/web/_duckduckgo.py +0 -111
- mirascope/tools/web/_httpx.py +0 -125
- mirascope/tools/web/_parse_url_content.py +0 -94
- mirascope/tools/web/_requests.py +0 -54
- mirascope/v0/__init__.py +0 -43
- mirascope/v0/anthropic.py +0 -54
- mirascope/v0/base/__init__.py +0 -12
- mirascope/v0/base/calls.py +0 -118
- mirascope/v0/base/extractors.py +0 -122
- mirascope/v0/base/ops_utils.py +0 -207
- mirascope/v0/base/prompts.py +0 -48
- mirascope/v0/base/types.py +0 -14
- mirascope/v0/base/utils.py +0 -21
- mirascope/v0/openai.py +0 -54
- mirascope-1.25.7.dist-info/METADATA +0 -169
- mirascope-1.25.7.dist-info/RECORD +0 -378
- {mirascope-1.25.7.dist-info → mirascope-2.0.0a0.dist-info}/WHEEL +0 -0
- {mirascope-1.25.7.dist-info → mirascope-2.0.0a0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mirascope
|
|
3
|
+
Version: 2.0.0a0
|
|
4
|
+
Summary: LLM abstractions that aren't obstructions
|
|
5
|
+
Project-URL: Homepage, https://mirascope.com
|
|
6
|
+
Project-URL: Documentation, https://mirascope.com/docs/mirascope/v2
|
|
7
|
+
Project-URL: Repository, https://github.com/Mirascope/mirascope/tree/v2
|
|
8
|
+
Project-URL: Issues, https://github.com/Mirascope/mirascope/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/Mirascope/mirascope/releases
|
|
10
|
+
Author-email: William Bakst <william@mirascope.com>, Dandelion Mané <dandelion@mirascope.com>
|
|
11
|
+
Maintainer-email: William Bakst <william@mirascope.com>, Dandelion Mané <dandelion@mirascope.com>
|
|
12
|
+
License: MIT License
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2023 Mirascope, Inc.
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
in the Software without restriction, including without limitation the rights
|
|
19
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
furnished to do so, subject to the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
copies or substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
SOFTWARE.
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
Keywords: agents,artificial intelligence,developer tools,llm,llm tools,prompt engineering
|
|
35
|
+
Classifier: Development Status :: 3 - Alpha
|
|
36
|
+
Classifier: Intended Audience :: Developers
|
|
37
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
43
|
+
Classifier: Topic :: File Formats :: JSON
|
|
44
|
+
Classifier: Topic :: File Formats :: JSON :: JSON Schema
|
|
45
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
46
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
47
|
+
Requires-Python: >=3.10
|
|
48
|
+
Requires-Dist: docstring-parser>=0.17.0
|
|
49
|
+
Requires-Dist: typing-extensions>=4.10.0
|
|
50
|
+
Provides-Extra: anthropic
|
|
51
|
+
Requires-Dist: anthropic<1.0,>=0.72.0; extra == 'anthropic'
|
|
52
|
+
Provides-Extra: google
|
|
53
|
+
Requires-Dist: google-genai<2,>=1.48.0; extra == 'google'
|
|
54
|
+
Requires-Dist: pillow<11,>=10.4.0; extra == 'google'
|
|
55
|
+
Requires-Dist: proto-plus>=1.24.0; extra == 'google'
|
|
56
|
+
Provides-Extra: mcp
|
|
57
|
+
Requires-Dist: mcp<2,>=1.0.0; extra == 'mcp'
|
|
58
|
+
Provides-Extra: openai
|
|
59
|
+
Requires-Dist: openai<3,>=2.7.1; extra == 'openai'
|
|
60
|
+
Description-Content-Type: text/markdown
|
|
61
|
+
|
|
62
|
+
## Mirascope v2 Python
|
|
63
|
+
|
|
64
|
+
This directory contains the Python implementation of Mirascope.
|
|
65
|
+
|
|
66
|
+
## Development Setup
|
|
67
|
+
|
|
68
|
+
1. **Environment Variables**: Copy `.env.example` to `.env` and fill in your API keys:
|
|
69
|
+
```bash
|
|
70
|
+
cp .env.example .env
|
|
71
|
+
# Edit .env with your API keys
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
2. **Install Dependencies**:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
uv sync --all-extras --dev
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
3. **Run Tests**:
|
|
81
|
+
```bash
|
|
82
|
+
uv run pytest
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Testing
|
|
86
|
+
|
|
87
|
+
### VCR Cassettes
|
|
88
|
+
|
|
89
|
+
The project uses [VCR.py](https://vcrpy.readthedocs.io/) to record and replay HTTP interactions with LLM APIs. This allows tests to run quickly and consistently without making actual API calls.
|
|
90
|
+
|
|
91
|
+
- **Cassettes Location**: Test cassettes are stored in `tests/llm/clients/*/cassettes/`
|
|
92
|
+
- **Recording Mode**: Tests use `"once"` mode - records new interactions if no cassette exists, replays existing cassettes otherwise
|
|
93
|
+
- **CI/CD**: In CI environments, tests use existing cassettes and never make real API calls
|
|
94
|
+
|
|
95
|
+
### Inline Snapshots
|
|
96
|
+
|
|
97
|
+
The project uses [inline-snapshot](https://15r10nk.github.io/inline-snapshot/) to capture expected test outputs directly in the test code.
|
|
98
|
+
|
|
99
|
+
- **Update Snapshots**: Run `uv run pytest --inline-snapshot=fix` to update all snapshots with actual values
|
|
100
|
+
- **Review Changes**: Run `uv run pytest --inline-snapshot=review` to preview what would change
|
|
101
|
+
- **Formatted Output**: Snapshots are automatically formatted with `ruff` for consistency
|
|
102
|
+
|
|
103
|
+
Example:
|
|
104
|
+
```python
|
|
105
|
+
def test_api_response():
|
|
106
|
+
response = client.call(messages=[user("Hello")])
|
|
107
|
+
assert response.content == snapshot([Text(text="Hi there!")])
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Recording New Test Interactions
|
|
111
|
+
|
|
112
|
+
To record new test interactions:
|
|
113
|
+
|
|
114
|
+
1. Ensure your API keys are set in `.env`
|
|
115
|
+
2. Delete the relevant cassette file (if updating an existing test)
|
|
116
|
+
3. Run the specific test: `uv run pytest tests/path/to/test.py::test_name`
|
|
117
|
+
4. The cassette will be automatically created/updated
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
mirascope/__init__.py,sha256=wKvhFqB-FAf_Fxi1_pEenLRUK-QGMbhlsY5aPGc0lug,98
|
|
2
|
+
mirascope/graphs/__init__.py,sha256=fkZHjSt6DvJAX-V3OCnDO7B1zJx5gv1Qp2G6P32wI7I,1086
|
|
3
|
+
mirascope/graphs/finite_state_machine.py,sha256=9j8kwQ6Ne3o-auP0KVdoA0hzW2txfM1wH3GSSnbZOyg,23261
|
|
4
|
+
mirascope/llm/__init__.py,sha256=qHerzIANTngmc1aXg_ga9S7dEY7rRj83e5Z61ObAdN4,4420
|
|
5
|
+
mirascope/llm/exceptions.py,sha256=30yPPCIr8Uwibqpt2Y0cDMsimVlQubAmjqbeO5kVpSA,3090
|
|
6
|
+
mirascope/llm/agents/__init__.py,sha256=aG5ymnBfa4ZFLfGPZjdXybwjC3lrlkkeLjKfx2Zzr0Q,363
|
|
7
|
+
mirascope/llm/agents/agent.py,sha256=obACeIZuD8FIUaZL_NF0u5GNeaxRpbyNb9PNipyYIZE,2959
|
|
8
|
+
mirascope/llm/agents/agent_template.py,sha256=7zm5piQrmClHFr7zw0EOMfWp009EGDfnGAaTtrw0twY,1478
|
|
9
|
+
mirascope/llm/agents/decorator.py,sha256=IrVQMQNd9VGUnngjM-2LqVccZCwQMT9oXsYvf4MMyvI,5025
|
|
10
|
+
mirascope/llm/calls/__init__.py,sha256=rnQ29w8x_EAEecZhP2i6N6u_qE-TO3sBZGAztF3o2QQ,273
|
|
11
|
+
mirascope/llm/calls/base_call.py,sha256=ghD8__Uw-RpL-TWI1zShThWugXmZCiEA2tLsZ-XHU0I,1021
|
|
12
|
+
mirascope/llm/calls/calls.py,sha256=R2hEGVsOHkZlBKcp4CvfssXABoLiIj9aKu80qrx6Ta4,9867
|
|
13
|
+
mirascope/llm/calls/decorator.py,sha256=77JLc1xIotl7dWxzyz5xYeKIRu8ykMxZ40yj9MNd79c,7472
|
|
14
|
+
mirascope/llm/clients/__init__.py,sha256=L00p7Kfk1gu8hSLXz3dvn3y0ku0rG6vPxq2vxRoukJI,770
|
|
15
|
+
mirascope/llm/clients/providers.py,sha256=GwZldKYXGaTPbkbAbGlCYyl2-CuR1dnz4smZGblyfqc,5095
|
|
16
|
+
mirascope/llm/clients/anthropic/__init__.py,sha256=wSYwKLkASUQHEsIjvuMSQHIZ6mhdyOymmzb3clL8SlU,231
|
|
17
|
+
mirascope/llm/clients/anthropic/clients.py,sha256=8Z1Ol8V-JwCxefT2mQYUrfduliES2Yvk88hyM4GCNvc,27460
|
|
18
|
+
mirascope/llm/clients/anthropic/model_ids.py,sha256=0vp-nhDCYMw_3sKFD_tQO2FRlW8QzKiwXKBQ_lEv0yo,197
|
|
19
|
+
mirascope/llm/clients/anthropic/_utils/__init__.py,sha256=U2VNfEJCaqorAJBZDV7p3rFEp1fyk7vSitYFv_5G5Cs,232
|
|
20
|
+
mirascope/llm/clients/anthropic/_utils/decode.py,sha256=zD5__20USLa4YuTMeZo-4oi2-whckP85Ez_ch_Mross,8992
|
|
21
|
+
mirascope/llm/clients/anthropic/_utils/encode.py,sha256=Bul-WPrb7XJ7LW5gIsU2dm1Xvi5TG2lhiotvzZiNcL4,8760
|
|
22
|
+
mirascope/llm/clients/base/__init__.py,sha256=Am1Hbe7iNnVKjcR8PT52NqHgVwFnQaMojEHVrdGHAWo,278
|
|
23
|
+
mirascope/llm/clients/base/_utils.py,sha256=JyVXkbsHgOD_CnCNkq-aVdSmD4me0M40NPsdCt0pKwg,6880
|
|
24
|
+
mirascope/llm/clients/base/client.py,sha256=ffgxwMJ2vmbUB-KKzPwpgumzmGT2IhIr1yGqxYt9oBk,42258
|
|
25
|
+
mirascope/llm/clients/base/kwargs.py,sha256=pjaHVqtlmScUBqG8ZAllVaLoepdKE-KYl2eTqzOBXm0,406
|
|
26
|
+
mirascope/llm/clients/base/params.py,sha256=x2WLz0s5rMZ3u3GBGQmRlYGjecePtsLglHSJBLh35YE,3670
|
|
27
|
+
mirascope/llm/clients/google/__init__.py,sha256=nrUGqVqbUmhi1Y3MNfbmp5ItooNHEV2D3cUNhyeRH_U,197
|
|
28
|
+
mirascope/llm/clients/google/clients.py,sha256=rsWJV5kfwh93RSRE6x45wnBhnP122mLCCuOdy1cD2u4,28073
|
|
29
|
+
mirascope/llm/clients/google/message.py,sha256=ryNsMKPSyBSVXl_H0MQEaSiWC3FFybjxIUuORNSiKTk,179
|
|
30
|
+
mirascope/llm/clients/google/model_ids.py,sha256=zJe9IAX4DIO6JXeTksAx77nwtlz1k2aO0YcJHsNpRx4,338
|
|
31
|
+
mirascope/llm/clients/google/_utils/__init__.py,sha256=U2VNfEJCaqorAJBZDV7p3rFEp1fyk7vSitYFv_5G5Cs,232
|
|
32
|
+
mirascope/llm/clients/google/_utils/decode.py,sha256=z__aZLIL130nCVV5CdAJPTiaCSw61mCrItTHVDffkQQ,9007
|
|
33
|
+
mirascope/llm/clients/google/_utils/encode.py,sha256=XFaRCzMQlUW3sm949pc-rPTavDgxSIjrxOllJ8KgR3k,10482
|
|
34
|
+
mirascope/llm/clients/openai/__init__.py,sha256=LkD4Kkxc-dnpR_K5f539xSfqEaXE1vioDcW7suOJhJE,600
|
|
35
|
+
mirascope/llm/clients/openai/completions/__init__.py,sha256=mdDQfZ0WI0tOH4OUrbnNBIe1kyqdj3y0r4q3LIwr4Os,223
|
|
36
|
+
mirascope/llm/clients/openai/completions/clients.py,sha256=GjfNV1ewRi1ADgsP0t5cxPdQUWyN65gRSPzDJFMhApg,28086
|
|
37
|
+
mirascope/llm/clients/openai/completions/model_ids.py,sha256=bno8SND8YbzoQE3Tjh9dxYo04luDILD3ndzQvgL5pAg,243
|
|
38
|
+
mirascope/llm/clients/openai/completions/_utils/__init__.py,sha256=U2VNfEJCaqorAJBZDV7p3rFEp1fyk7vSitYFv_5G5Cs,232
|
|
39
|
+
mirascope/llm/clients/openai/completions/_utils/decode.py,sha256=yiXPQwL33YNVxIZAABohqSO3ElEtiShVSki8fPQWf0A,6539
|
|
40
|
+
mirascope/llm/clients/openai/completions/_utils/encode.py,sha256=q2jP8By9TUiv66-oJpWZddn709ZRIGkXniSPTxLR2Co,13227
|
|
41
|
+
mirascope/llm/clients/openai/completions/_utils/model_features.py,sha256=iIm0uxNNfYOJ4qn1wmZjNrkCXNJK5czOPmn5UVBIjz4,3397
|
|
42
|
+
mirascope/llm/clients/openai/responses/__init__.py,sha256=PofDWzyxz__hD1AaHn2hQkIPs7xxyiBcgDoCl39Tlq4,215
|
|
43
|
+
mirascope/llm/clients/openai/responses/clients.py,sha256=dMIdp-Ua_stFAtT99gDp89woUyLyWShO4aAz8G_2nog,27627
|
|
44
|
+
mirascope/llm/clients/openai/responses/model_ids.py,sha256=30OQ8wnIVp6A3I4NsTPBLqfi-SB5dhzyB7ic5p_XXhg,239
|
|
45
|
+
mirascope/llm/clients/openai/responses/_utils/__init__.py,sha256=U2VNfEJCaqorAJBZDV7p3rFEp1fyk7vSitYFv_5G5Cs,232
|
|
46
|
+
mirascope/llm/clients/openai/responses/_utils/decode.py,sha256=4D0clsSEhdF3d_z1dF1D54PmNEDm-88YBFwLldAWKfg,7583
|
|
47
|
+
mirascope/llm/clients/openai/responses/_utils/encode.py,sha256=K4Dod2Hs2ncTKTr26kbFRwmVmKqixRL1nLR51nJ9R20,12374
|
|
48
|
+
mirascope/llm/clients/openai/responses/_utils/model_features.py,sha256=nZdT7Wp38o7-u5-zUK2Oqe8KaxLbULad2DWKZDkXALQ,2295
|
|
49
|
+
mirascope/llm/clients/openai/shared/__init__.py,sha256=x4koHwL1YsrZ-vzJ-RZks9xEVUUwGuMmthxRXlmQUqc,104
|
|
50
|
+
mirascope/llm/clients/openai/shared/_utils.py,sha256=iWlQmkQXIk4J65zosjW0KiShZPEUpqgB9axrJIUfnJ4,1678
|
|
51
|
+
mirascope/llm/content/__init__.py,sha256=jgAxB-QvtT6vZduv1ADIc5yFlhTyyk1PtUuBirRXxRI,1877
|
|
52
|
+
mirascope/llm/content/audio.py,sha256=W6liY1PuQ0pF91eDBnNKW52dr-G7-vnd-rhlSqebx9Y,5311
|
|
53
|
+
mirascope/llm/content/document.py,sha256=oz3LSUEhJh-lEUDCss5p_xkPBDYQhAu9m9SGFr64_pI,2369
|
|
54
|
+
mirascope/llm/content/image.py,sha256=lG0nPvObNEva1XjqUJcZI2T7jZ1xhHaSjqsCncg0XEU,6155
|
|
55
|
+
mirascope/llm/content/text.py,sha256=4lDzXXpDy601RAkv9m85InP_CklvLccFATPThBcY1Ho,1099
|
|
56
|
+
mirascope/llm/content/thought.py,sha256=jWtlVWoS-fDjByD-m2SPdPNNxvQhfwfOio0B95j10qU,1729
|
|
57
|
+
mirascope/llm/content/tool_call.py,sha256=Ogs-_ya50dc4Zb-bfNYFaMVdO5ZHpz4caGmr6ExGrVc,1613
|
|
58
|
+
mirascope/llm/content/tool_output.py,sha256=cCaRvfoR8QFQwnI90rfZjIEkK1GVBia3YJ5BjlOoojs,661
|
|
59
|
+
mirascope/llm/context/__init__.py,sha256=2Bx8CQhTXWbtwMirZ8ppmFKPXjuYezyi10XfmRpAE5I,179
|
|
60
|
+
mirascope/llm/context/_utils.py,sha256=lZ2aoAfT7XuIZvQdqGBzOMarAFZNMW0M2HAfD25flkU,907
|
|
61
|
+
mirascope/llm/context/context.py,sha256=qvmRXsyea34wXP-_0CCe6RwkT3H57dojCw6HHnv8LVc,629
|
|
62
|
+
mirascope/llm/formatting/__init__.py,sha256=N7cvwRFqNC1udcPSZPMLMX-1eNhEtqoZzH1uuAtEX7w,592
|
|
63
|
+
mirascope/llm/formatting/_utils.py,sha256=lb7UbFXuubkeuptZ_E2w-FEokGg1SEXOH5wUP1VXMT8,2292
|
|
64
|
+
mirascope/llm/formatting/format.py,sha256=KraFe0mh6b9J7bkY6yJgM_4nthGVfKXYbpVv-WPe3Ic,3621
|
|
65
|
+
mirascope/llm/formatting/from_call_args.py,sha256=OmCzqWn47W_IXOsl1-F2Um-w4E3q71kFLA9I6L093GI,920
|
|
66
|
+
mirascope/llm/formatting/partial.py,sha256=_7WlcHvjNJIVrYGVCGphu5Y6UyZQlKyENp05QAtyJ0Q,1785
|
|
67
|
+
mirascope/llm/formatting/types.py,sha256=GSoY82khvf53lwh8qEVIoeslVvoinx8cwLhh_NygB9k,4086
|
|
68
|
+
mirascope/llm/mcp/__init__.py,sha256=qVMSydtTuNezpxv91w5JoV9b3-1s743X-bxh012JmjQ,192
|
|
69
|
+
mirascope/llm/mcp/client.py,sha256=jbOn0QohgEu40JXvjENM7VE7pws8em3Jyx-Yn1YWZ_s,3613
|
|
70
|
+
mirascope/llm/messages/__init__.py,sha256=YJ4D-s_vQd76GTRmRstI2i9Yx561plmURf-zrydKjSo,708
|
|
71
|
+
mirascope/llm/messages/message.py,sha256=7pXiNqJkO3_DhkJPVwmI88bfDLf-31lo6Y_LIp3lcP8,6114
|
|
72
|
+
mirascope/llm/models/__init__.py,sha256=5Mo-hH-wqiBnCGcs-WG17JR2zBrAGgjMtZNNN4MRDkU,513
|
|
73
|
+
mirascope/llm/models/models.py,sha256=vi3dTml08J0dc74-9ALY8DorhfJKKwqEfCsecX44Wwk,41577
|
|
74
|
+
mirascope/llm/prompts/__init__.py,sha256=OoNJX1vlhpSUoKsig_RwbcOcNS43CNcAioUsht5KVUg,650
|
|
75
|
+
mirascope/llm/prompts/_utils.py,sha256=dTLeB6YjLniev_R93N0FH9J7zaVXnrej3crRZonRuBA,1760
|
|
76
|
+
mirascope/llm/prompts/decorator.py,sha256=hWqGIW5xdYGo-H_bNIP0zzY-HdwATozfDi8ZU_SUZIQ,8589
|
|
77
|
+
mirascope/llm/prompts/protocols.py,sha256=a5k0_WCGMmNo2exgK-2eBBhDg19olCbM2b002LZPlDg,2690
|
|
78
|
+
mirascope/llm/responses/__init__.py,sha256=bWEY1_AkJxBTtq3ML3cJM2arU1XOoDFCv2QvukFz73c,1308
|
|
79
|
+
mirascope/llm/responses/_utils.py,sha256=JkKXzG6-WqAbbmWLKOmbe7gDpp9xwg7xNHXryFbt6ME,1662
|
|
80
|
+
mirascope/llm/responses/base_response.py,sha256=nReMXPSXqo42KJD9SClyggjkYnEfZn_t1u9RHOonrl4,3684
|
|
81
|
+
mirascope/llm/responses/base_stream_response.py,sha256=x-HBW7_mSm4TiRrvBY60cFkp-qQrJlZjt_VcLeI91d4,27787
|
|
82
|
+
mirascope/llm/responses/finish_reason.py,sha256=1iSVaTZP8zlTwc9Pr4r10AzGkMz0iy0om8vKsHJ0OUY,742
|
|
83
|
+
mirascope/llm/responses/response.py,sha256=nsZr2vygDBBEQAIWwrfjL-YOWJ1MbrUOkwhhY1YU0CU,11774
|
|
84
|
+
mirascope/llm/responses/root_response.py,sha256=pATfCrvwsLE4dgx3CA9ZONqcltqg9yHk9uHPQcFxYsM,6128
|
|
85
|
+
mirascope/llm/responses/stream_response.py,sha256=g8hGoKL94intm5w5mOpAh2QAH1eiCbNIJYYgknIOcM0,23656
|
|
86
|
+
mirascope/llm/responses/streams.py,sha256=TmEFvLVEWHfVYplik61yUWisxe8JGbaZdh7yC7e-axI,10789
|
|
87
|
+
mirascope/llm/tools/__init__.py,sha256=3xIhEzpLlTkuDuvkfwVy3gLPRTTJCJH5GKkqCGjgo3A,772
|
|
88
|
+
mirascope/llm/tools/_utils.py,sha256=bBVsZs8SywWspVGBGR7GGuhSmGa5-wCzeXGV6Woof9Q,872
|
|
89
|
+
mirascope/llm/tools/decorator.py,sha256=kZ90qrE7jZHcW5fg3O-SOh6xiI6yjT4fz548e4AxvQc,5326
|
|
90
|
+
mirascope/llm/tools/protocols.py,sha256=VubSZm-N2QEnBzFTsnj4pRtIgJOx2GQWM4IyqZjDk1Q,3054
|
|
91
|
+
mirascope/llm/tools/tool_schema.py,sha256=vFGVNOa8ZrE6gnwelBcPKYK7-0ULqVtlr1oXZsbVxKY,8358
|
|
92
|
+
mirascope/llm/tools/toolkit.py,sha256=pGXchFSO2H7PxFM2sPQYEMDAYHNaX9bhGEyyou_4vsg,4900
|
|
93
|
+
mirascope/llm/tools/tools.py,sha256=AEgTEZoRTxictYxPDxdX18_Ho2sD8SIa-LUTngNHPiM,5972
|
|
94
|
+
mirascope/llm/types/__init__.py,sha256=lqzi1FkZ-s-D9-KQzVkAHuQQ1zp6B6yM3r9UNo46teE,357
|
|
95
|
+
mirascope/llm/types/dataclass.py,sha256=y4_9M3Yqw_4I-H0V4TwvgGIp6JvRdtpW11NxqufnsJk,247
|
|
96
|
+
mirascope/llm/types/jsonable.py,sha256=KY6l21_RBhlHQRXQ_xy6pUqqbTVb_jVFSU4ykRy_OLU,1104
|
|
97
|
+
mirascope/llm/types/type_vars.py,sha256=OsAcQAZh5T_X8ZTLlP4GC1x3qgVY9rfYSnME8aMTDxw,642
|
|
98
|
+
mirascope-2.0.0a0.dist-info/METADATA,sha256=FySDVeLpjaHcLhgRrb12tjVMSLxojbv7AFcnJObI0XU,5035
|
|
99
|
+
mirascope-2.0.0a0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
100
|
+
mirascope-2.0.0a0.dist-info/licenses/LICENSE,sha256=LAs5Q8mdawTsVdONpDGukwsoc4KEUBmmonDEL39b23Y,1072
|
|
101
|
+
mirascope-2.0.0a0.dist-info/RECORD,,
|
mirascope/beta/__init__.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from .realtime import (
|
|
2
|
-
Context,
|
|
3
|
-
OpenAIRealtimeTool,
|
|
4
|
-
Realtime,
|
|
5
|
-
async_input,
|
|
6
|
-
record,
|
|
7
|
-
record_as_stream,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
__all__ = [
|
|
11
|
-
"Context",
|
|
12
|
-
"OpenAIRealtimeTool",
|
|
13
|
-
"Realtime",
|
|
14
|
-
"async_input",
|
|
15
|
-
"record",
|
|
16
|
-
"record_as_stream",
|
|
17
|
-
]
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
from ._utils import Context
|
|
2
|
-
from .realtime import Realtime
|
|
3
|
-
from .recording import async_input, record, record_as_stream
|
|
4
|
-
from .tool import OpenAIRealtimeTool
|
|
5
|
-
|
|
6
|
-
__all__ = [
|
|
7
|
-
"Context",
|
|
8
|
-
"OpenAIRealtimeTool",
|
|
9
|
-
"Realtime",
|
|
10
|
-
"async_input",
|
|
11
|
-
"record",
|
|
12
|
-
"record_as_stream",
|
|
13
|
-
]
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import base64
|
|
3
|
-
import io
|
|
4
|
-
from io import BytesIO
|
|
5
|
-
from typing import Any
|
|
6
|
-
|
|
7
|
-
from pydub import AudioSegment
|
|
8
|
-
|
|
9
|
-
SAMPLE_WIDTH = 2
|
|
10
|
-
FRAME_RATE = 24000
|
|
11
|
-
CHANNELS = 1
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def audio_chunk_to_audio_segment(audio_bytes: bytes) -> AudioSegment:
|
|
15
|
-
return AudioSegment.from_raw(
|
|
16
|
-
io.BytesIO(audio_bytes),
|
|
17
|
-
sample_width=SAMPLE_WIDTH,
|
|
18
|
-
frame_rate=FRAME_RATE,
|
|
19
|
-
channels=CHANNELS,
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def _encode_pcm_as_base64(audio_bytes: bytes | BytesIO) -> str:
|
|
24
|
-
# Load the audio file from the byte stream
|
|
25
|
-
audio = AudioSegment.from_file(
|
|
26
|
-
io.BytesIO(audio_bytes) if isinstance(audio_bytes, bytes) else audio_bytes
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
# Resample to 24kHz mono pcm16
|
|
30
|
-
pcm_audio = (
|
|
31
|
-
audio.set_frame_rate(FRAME_RATE)
|
|
32
|
-
.set_channels(CHANNELS)
|
|
33
|
-
.set_sample_width(SAMPLE_WIDTH)
|
|
34
|
-
.raw_data
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
# Encode to base64 string
|
|
38
|
-
return base64.b64encode(pcm_audio).decode()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def audio_to_input_audio_buffer_append_event(
|
|
42
|
-
audio_bytes: bytes | BytesIO,
|
|
43
|
-
) -> dict[str, Any]:
|
|
44
|
-
return {
|
|
45
|
-
"type": "input_audio_buffer.append",
|
|
46
|
-
"audio": _encode_pcm_as_base64(audio_bytes),
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
async def async_audio_input_audio_buffer_append_event(
|
|
51
|
-
audio_bytes: bytes | BytesIO,
|
|
52
|
-
) -> dict[str, Any]:
|
|
53
|
-
return await asyncio.to_thread(
|
|
54
|
-
audio_to_input_audio_buffer_append_event, audio_bytes
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def audio_to_item_create_event(audio_bytes: bytes | BytesIO) -> dict[str, Any]:
|
|
59
|
-
return {
|
|
60
|
-
"type": "conversation.item.create",
|
|
61
|
-
"item": {
|
|
62
|
-
"type": "message",
|
|
63
|
-
"role": "user",
|
|
64
|
-
"content": [
|
|
65
|
-
{"type": "input_audio", "audio": _encode_pcm_as_base64(audio_bytes)}
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
async def async_audio_to_item_create_event(
|
|
72
|
-
audio_bytes: bytes | BytesIO,
|
|
73
|
-
) -> dict[str, Any]:
|
|
74
|
-
return await asyncio.to_thread(audio_to_item_create_event, audio_bytes)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
from collections.abc import AsyncGenerator, Awaitable, Callable, Coroutine
|
|
2
|
-
from typing import (
|
|
3
|
-
Any,
|
|
4
|
-
Protocol,
|
|
5
|
-
TypeAlias,
|
|
6
|
-
TypeVar,
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
from ..tool import OpenAIRealtimeTool
|
|
10
|
-
|
|
11
|
-
_ToolTypeBase: TypeAlias = type[OpenAIRealtimeTool] | Callable
|
|
12
|
-
|
|
13
|
-
_ResponseBaseType = str | bytes
|
|
14
|
-
_ResponseT = TypeVar("_ResponseT", bound=_ResponseBaseType)
|
|
15
|
-
_ReceiverArgumentT = TypeVar("_ReceiverArgumentT")
|
|
16
|
-
_ToolType = TypeVar("_ToolType", bound=_ToolTypeBase)
|
|
17
|
-
# TODO: Improve the type of context
|
|
18
|
-
Context: TypeAlias = dict[str, Any]
|
|
19
|
-
_OpenAIRealtimeToolT = TypeVar("_OpenAIRealtimeToolT", bound=OpenAIRealtimeTool)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class SenderFunc(Protocol[_ResponseT]):
|
|
23
|
-
def __call__(
|
|
24
|
-
self, context: Context
|
|
25
|
-
) -> (
|
|
26
|
-
AsyncGenerator[
|
|
27
|
-
_ResponseT | tuple[_ResponseT, list[type[OpenAIRealtimeTool] | Callable]],
|
|
28
|
-
None,
|
|
29
|
-
]
|
|
30
|
-
| Coroutine[
|
|
31
|
-
Any,
|
|
32
|
-
Any,
|
|
33
|
-
_ResponseT | tuple[_ResponseT, list[type[OpenAIRealtimeTool] | Callable]],
|
|
34
|
-
]
|
|
35
|
-
| Awaitable[
|
|
36
|
-
_ResponseT | tuple[_ResponseT, list[type[OpenAIRealtimeTool] | Callable]]
|
|
37
|
-
]
|
|
38
|
-
): ...
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class ReceiverFunc(Protocol[_ReceiverArgumentT]):
|
|
42
|
-
def __call__(
|
|
43
|
-
self, response: _ReceiverArgumentT, context: Context
|
|
44
|
-
) -> Awaitable[None]: ...
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class FunctionCallHandlerFunc(Protocol):
|
|
48
|
-
def __call__(
|
|
49
|
-
self, tool: _OpenAIRealtimeToolT, context: Context
|
|
50
|
-
) -> Awaitable[str] | str: ...
|