moda-openai 0.1.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.
- moda_openai-0.1.0/.gitignore +185 -0
- moda_openai-0.1.0/.python-version +1 -0
- moda_openai-0.1.0/PKG-INFO +49 -0
- moda_openai-0.1.0/README.md +33 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/__init__.py +54 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/shared/__init__.py +399 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/shared/chat_wrappers.py +1208 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/shared/completion_wrappers.py +292 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/shared/config.py +15 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +311 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/shared/event_emitter.py +108 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/shared/event_models.py +41 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +68 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/shared/span_utils.py +0 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/utils.py +190 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/v0/__init__.py +176 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/v1/__init__.py +374 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +329 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +134 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/v1/realtime_wrappers.py +730 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/v1/responses_wrappers.py +1113 -0
- moda_openai-0.1.0/opentelemetry/instrumentation/openai/version.py +1 -0
- moda_openai-0.1.0/poetry.toml +2 -0
- moda_openai-0.1.0/project.json +77 -0
- moda_openai-0.1.0/pyproject.toml +73 -0
- moda_openai-0.1.0/pytest.ini +2 -0
- moda_openai-0.1.0/tests/__init__.py +1 -0
- moda_openai-0.1.0/tests/conftest.py +199 -0
- moda_openai-0.1.0/tests/data/1024+tokens.txt +104 -0
- moda_openai-0.1.0/tests/metrics/__init__.py +0 -0
- moda_openai-0.1.0/tests/metrics/cassettes/test_openai_metrics/test_chat_completion_metrics.yaml +216 -0
- moda_openai-0.1.0/tests/metrics/cassettes/test_openai_metrics/test_chat_completion_metrics_stream.yaml +196 -0
- moda_openai-0.1.0/tests/metrics/cassettes/test_openai_metrics/test_chat_parsed_completion_metrics.yaml +115 -0
- moda_openai-0.1.0/tests/metrics/cassettes/test_openai_metrics/test_chat_streaming_metrics.yaml +402 -0
- moda_openai-0.1.0/tests/metrics/cassettes/test_openai_metrics/test_embeddings_metrics.yaml +399 -0
- moda_openai-0.1.0/tests/metrics/cassettes/test_openai_metrics/test_image_gen_metrics.yaml +87 -0
- moda_openai-0.1.0/tests/metrics/conftest.py +9 -0
- moda_openai-0.1.0/tests/metrics/test_openai_metrics.py +311 -0
- moda_openai-0.1.0/tests/traces/__init__.py +0 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_existing_assistant.yaml +1806 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_existing_assistant_with_events_with_content.yaml +1806 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_existing_assistant_with_events_with_no_content.yaml +1806 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_new_assistant.yaml +872 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_new_assistant_with_events_with_content.yaml +872 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_new_assistant_with_events_with_no_content.yaml +872 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_new_assistant_with_polling.yaml +1322 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_new_assistant_with_polling_with_events_with_content.yaml +1322 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_new_assistant_with_polling_with_events_with_no_content.yaml +1322 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_streaming_existing_assistant.yaml +840 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_streaming_existing_assistant_with_events_with_content.yaml +840 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_streaming_existing_assistant_with_events_with_no_content.yaml +840 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_streaming_new_assistant.yaml +1711 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_streaming_new_assistant_with_events_with_content.yaml +1711 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_assistant/test_streaming_new_assistant_with_events_with_no_content.yaml +1711 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat.yaml +81 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_async_streaming.yaml +190 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_async_streaming_with_events_with_content.yaml +190 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_async_streaming_with_events_with_no_content.yaml +190 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_content_filtering.yaml +79 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_content_filtering_with_events_with_content.yaml +79 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_content_filtering_with_events_with_no_content.yaml +79 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_reasoning.yaml +81 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_streaming.yaml +177 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_streaming_with_events_with_content.yaml +177 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_streaming_with_events_with_no_content.yaml +177 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_with_events_with_content.yaml +81 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_chat_with_events_with_no_content.yaml +81 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_prompt_content_filtering.yaml +109 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_prompt_content_filtering_with_events_with_content.yaml +109 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_azure/test_prompt_content_filtering_with_events_with_no_content.yaml +109 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_async_context_propagation.yaml +57 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_async_context_propagation_with_events_with_content.yaml +57 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_async_context_propagation_with_events_with_no_content.yaml +57 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_async_streaming.yaml +192 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_async_streaming_with_events_with_content.yaml +192 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_async_streaming_with_events_with_no_content.yaml +192 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_context_propagation.yaml +57 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_context_propagation_with_events_with_content.yaml +57 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_context_propagation_with_events_with_no_content.yaml +57 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_history_message_dict.yaml +212 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_history_message_pydantic.yaml +212 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_pydantic_based_tool_calls.yaml +99 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_pydantic_based_tool_calls_with_events_with_content.yaml +99 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_pydantic_based_tool_calls_with_events_with_no_content.yaml +99 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_reasoning.yaml +106 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_streaming.yaml +256 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_streaming_exception_during_consumption.yaml +188 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_streaming_memory_leak_prevention.yaml +188 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_streaming_not_consumed.yaml +188 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_streaming_partial_consumption.yaml +188 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_streaming_with_events_with_content.yaml +188 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_streaming_with_events_with_no_content.yaml +188 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tool_calls.yaml +97 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tool_calls_with_events_with_content.yaml +97 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tool_calls_with_events_with_no_content.yaml +97 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tools.yaml +101 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tools_async_streaming.yaml +119 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tools_async_streaming_with_events_with_content.yaml +119 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tools_async_streaming_with_events_with_no_content.yaml +119 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tools_streaming.yaml +119 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tools_streaming_with_events_with_content.yaml +119 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tools_streaming_with_events_with_no_content.yaml +119 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tools_with_events_with_content.yaml +101 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_tools_with_events_with_no_content.yaml +101 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_with_events_with_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_with_events_with_no_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_chat_with_service_tier.yaml +113 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_with_asyncio_run.yaml +103 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_with_asyncio_run_with_events_with_content.yaml +103 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat/test_with_asyncio_run_with_events_with_no_content.yaml +103 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_async_parsed_completion.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_async_parsed_completion_with_events_with_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_async_parsed_completion_with_events_with_no_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_async_parsed_refused_completion.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_async_parsed_refused_completion_with_events_with_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_async_parsed_refused_completion_with_events_with_no_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_parsed_completion.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_parsed_completion_with_events_with_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_parsed_completion_with_events_with_no_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_parsed_refused_completion.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_parsed_refused_completion_with_events_with_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_parse/test_parsed_refused_completion_with_events_with_no_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_response_format/test_async_chat_response_format.yaml +114 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_chat_response_format/test_chat_response_format.yaml +114 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_async_completion.yaml +100 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_async_completion_context_propagation.yaml +56 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_async_completion_context_propagation_with_events_with_content.yaml +56 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_async_completion_context_propagation_with_events_with_no_content.yaml +56 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_async_completion_streaming.yaml +121 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_async_completion_streaming_with_events_with_content.yaml +121 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_async_completion_streaming_with_events_with_no_content.yaml +121 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_async_completion_with_events_with_content.yaml +100 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_async_completion_with_events_with_no_content.yaml +100 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion.yaml +99 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_context_propagation.yaml +56 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_context_propagation_with_events_with_content.yaml +56 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_context_propagation_with_events_with_no_content.yaml +56 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_langchain_style.yaml +100 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_langchain_style_with_events_with_content.yaml +100 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_langchain_style_with_events_with_no_content.yaml +100 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_streaming.yaml +493 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_streaming_with_events_with_content.yaml +155 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_streaming_with_events_with_no_content.yaml +155 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_with_events_with_content.yaml +99 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_completions/test_completion_with_events_with_no_content.yaml +99 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_async_embeddings_context_propagation.yaml +55 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_async_embeddings_context_propagation_with_events_with_content.yaml +55 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_async_embeddings_context_propagation_with_events_with_no_content.yaml +55 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_azure_openai_embeddings.yaml +146 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_azure_openai_embeddings_with_events_with_content.yaml +146 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_azure_openai_embeddings_with_events_with_no_content.yaml +146 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_embeddings.yaml +399 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_embeddings_context_propagation.yaml +55 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_embeddings_context_propagation_with_events_with_content.yaml +55 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_embeddings_context_propagation_with_events_with_no_content.yaml +55 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_embeddings_with_events_with_content.yaml +399 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_embeddings_with_events_with_no_content.yaml +399 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_embeddings_with_raw_response.yaml +403 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_embeddings_with_raw_response_with_events_with_content.yaml +403 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_embeddings/test_embeddings_with_raw_response_with_events_with_no_content.yaml +403 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_exceptions/test_exception_in_instrumentation_suppressed.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls.yaml +207 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools.yaml +108 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_parallel.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_parallel_with_events_with_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_parallel_with_events_with_no_content.yaml +102 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_streaming.yaml +126 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_streaming_parallel.yaml +142 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_streaming_parallel_with_events_with_content.yaml +142 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_streaming_parallel_with_events_with_no_content.yaml +142 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_streaming_with_events_with_content.yaml +126 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_streaming_with_events_with_no_content.yaml +126 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_with_events_with_content.yaml +108 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_tools_with_events_with_no_content.yaml +108 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_with_events_with_content.yaml +207 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_functions/test_open_ai_function_calls_with_events_with_no_content.yaml +207 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_prompt_caching/test_openai_prompt_caching.yaml +397 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_prompt_caching/test_openai_prompt_caching_async.yaml +393 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_prompt_caching/test_openai_prompt_caching_async_with_events_with_content.yaml +393 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_prompt_caching/test_openai_prompt_caching_async_with_events_with_no_content.yaml +393 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_prompt_caching/test_openai_prompt_caching_with_events_with_content.yaml +397 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_prompt_caching/test_openai_prompt_caching_with_events_with_no_content.yaml +397 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses.yaml +104 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_reasoning.yaml +107 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_reasoning_dict_issue.yaml +136 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_streaming.yaml +255 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_streaming_async.yaml +591 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_streaming_async_with_context_manager.yaml +202 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_streaming_async_with_parent_span.yaml +165 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_streaming_with_content.yaml +172 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_streaming_with_context_manager.yaml +202 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_streaming_with_parent_span.yaml +186 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_tool_calls.yaml +113 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_with_input_history.yaml +211 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_with_request_params.yaml +111 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_responses/test_responses_with_service_tier.yaml +110 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_streaming_with_api_usage/test_streaming_with_api_usage_and_events.yaml +775 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_streaming_with_api_usage/test_streaming_with_api_usage_capture.yaml +164 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_vision/test_vision.yaml +191 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_vision/test_vision_base64.yaml +18831 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_vision/test_vision_base64_with_events_with_content.yaml +18831 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_vision/test_vision_base64_with_events_with_no_content.yaml +18831 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_vision/test_vision_with_events_with_content.yaml +191 -0
- moda_openai-0.1.0/tests/traces/cassettes/test_vision/test_vision_with_events_with_no_content.yaml +191 -0
- moda_openai-0.1.0/tests/traces/conftest.py +9 -0
- moda_openai-0.1.0/tests/traces/test_assistant.py +1229 -0
- moda_openai-0.1.0/tests/traces/test_azure.py +799 -0
- moda_openai-0.1.0/tests/traces/test_chat.py +1834 -0
- moda_openai-0.1.0/tests/traces/test_chat_parse.py +597 -0
- moda_openai-0.1.0/tests/traces/test_chat_response_format.py +87 -0
- moda_openai-0.1.0/tests/traces/test_completions.py +959 -0
- moda_openai-0.1.0/tests/traces/test_embedding_metrics_handler.py +46 -0
- moda_openai-0.1.0/tests/traces/test_embeddings.py +659 -0
- moda_openai-0.1.0/tests/traces/test_exceptions.py +50 -0
- moda_openai-0.1.0/tests/traces/test_functions.py +950 -0
- moda_openai-0.1.0/tests/traces/test_prompt_caching.py +511 -0
- moda_openai-0.1.0/tests/traces/test_realtime.py +860 -0
- moda_openai-0.1.0/tests/traces/test_responses.py +820 -0
- moda_openai-0.1.0/tests/traces/test_span_context_propagation.py +58 -0
- moda_openai-0.1.0/tests/traces/test_streaming_with_api_usage.py +76 -0
- moda_openai-0.1.0/tests/traces/test_vision.py +404 -0
- moda_openai-0.1.0/tests/traces/utils.py +27 -0
- moda_openai-0.1.0/uv.lock +1283 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# compiled output
|
|
4
|
+
dist
|
|
5
|
+
tmp
|
|
6
|
+
/out-tsc
|
|
7
|
+
|
|
8
|
+
# dependencies
|
|
9
|
+
node_modules
|
|
10
|
+
|
|
11
|
+
# IDEs and editors
|
|
12
|
+
/.idea
|
|
13
|
+
.project
|
|
14
|
+
.classpath
|
|
15
|
+
.c9/
|
|
16
|
+
*.launch
|
|
17
|
+
.settings/
|
|
18
|
+
*.sublime-workspace
|
|
19
|
+
|
|
20
|
+
# IDE - VSCode
|
|
21
|
+
.vscode/*
|
|
22
|
+
!.vscode/settings.json
|
|
23
|
+
!.vscode/tasks.json
|
|
24
|
+
!.vscode/launch.json
|
|
25
|
+
!.vscode/extensions.json
|
|
26
|
+
|
|
27
|
+
# misc
|
|
28
|
+
/.sass-cache
|
|
29
|
+
/connect.lock
|
|
30
|
+
/coverage
|
|
31
|
+
/libpeerconnection.log
|
|
32
|
+
npm-debug.log
|
|
33
|
+
yarn-error.log
|
|
34
|
+
testem.log
|
|
35
|
+
/typings
|
|
36
|
+
|
|
37
|
+
# System Files
|
|
38
|
+
.DS_Store
|
|
39
|
+
Thumbs.db
|
|
40
|
+
|
|
41
|
+
.cache/
|
|
42
|
+
reports/
|
|
43
|
+
.vscode/
|
|
44
|
+
|
|
45
|
+
# Byte-compiled / optimized / DLL files
|
|
46
|
+
__pycache__/
|
|
47
|
+
*.py[cod]
|
|
48
|
+
*$py.class
|
|
49
|
+
|
|
50
|
+
# C extensions
|
|
51
|
+
*.so
|
|
52
|
+
|
|
53
|
+
# Distribution / packaging
|
|
54
|
+
.Python
|
|
55
|
+
build/
|
|
56
|
+
develop-eggs/
|
|
57
|
+
dist/
|
|
58
|
+
downloads/
|
|
59
|
+
eggs/
|
|
60
|
+
.eggs/
|
|
61
|
+
lib/
|
|
62
|
+
lib64/
|
|
63
|
+
parts/
|
|
64
|
+
sdist/
|
|
65
|
+
var/
|
|
66
|
+
wheels/
|
|
67
|
+
share/python-wheels/
|
|
68
|
+
*.egg-info/
|
|
69
|
+
.installed.cfg
|
|
70
|
+
*.egg
|
|
71
|
+
MANIFEST
|
|
72
|
+
|
|
73
|
+
# PyInstaller
|
|
74
|
+
# Usually these files are written by a python script from a template
|
|
75
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
76
|
+
*.manifest
|
|
77
|
+
*.spec
|
|
78
|
+
|
|
79
|
+
# Installer logs
|
|
80
|
+
pip-log.txt
|
|
81
|
+
pip-delete-this-directory.txt
|
|
82
|
+
|
|
83
|
+
# Unit test / coverage reports
|
|
84
|
+
htmlcov/
|
|
85
|
+
.tox/
|
|
86
|
+
.nox/
|
|
87
|
+
.coverage
|
|
88
|
+
.coverage.*
|
|
89
|
+
.cache
|
|
90
|
+
nosetests.xml
|
|
91
|
+
coverage.xml
|
|
92
|
+
*.cover
|
|
93
|
+
*.py,cover
|
|
94
|
+
.hypothesis/
|
|
95
|
+
.pytest_cache/
|
|
96
|
+
cover/
|
|
97
|
+
|
|
98
|
+
# Translations
|
|
99
|
+
*.mo
|
|
100
|
+
*.pot
|
|
101
|
+
|
|
102
|
+
# Django stuff:
|
|
103
|
+
*.log
|
|
104
|
+
local_settings.py
|
|
105
|
+
db.sqlite3
|
|
106
|
+
db.sqlite3-journal
|
|
107
|
+
|
|
108
|
+
# Flask stuff:
|
|
109
|
+
instance/
|
|
110
|
+
.webassets-cache
|
|
111
|
+
|
|
112
|
+
# Scrapy stuff:
|
|
113
|
+
.scrapy
|
|
114
|
+
|
|
115
|
+
# Sphinx documentation
|
|
116
|
+
docs/_build/
|
|
117
|
+
|
|
118
|
+
# PyBuilder
|
|
119
|
+
.pybuilder/
|
|
120
|
+
target/
|
|
121
|
+
|
|
122
|
+
# Jupyter Notebook
|
|
123
|
+
.ipynb_checkpoints
|
|
124
|
+
|
|
125
|
+
# IPython
|
|
126
|
+
profile_default/
|
|
127
|
+
ipython_config.py
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# SageMath parsed files
|
|
137
|
+
*.sage.py
|
|
138
|
+
|
|
139
|
+
# Environments
|
|
140
|
+
.env
|
|
141
|
+
.venv
|
|
142
|
+
env/
|
|
143
|
+
venv/
|
|
144
|
+
ENV/
|
|
145
|
+
env.bak/
|
|
146
|
+
venv.bak/
|
|
147
|
+
|
|
148
|
+
# Spyder project settings
|
|
149
|
+
.spyderproject
|
|
150
|
+
.spyproject
|
|
151
|
+
|
|
152
|
+
# Rope project settings
|
|
153
|
+
.ropeproject
|
|
154
|
+
|
|
155
|
+
# mkdocs documentation
|
|
156
|
+
/site
|
|
157
|
+
|
|
158
|
+
# mypy
|
|
159
|
+
.mypy_cache/
|
|
160
|
+
.dmypy.json
|
|
161
|
+
dmypy.json
|
|
162
|
+
|
|
163
|
+
# Pyre type checker
|
|
164
|
+
.pyre/
|
|
165
|
+
|
|
166
|
+
# pytype static type analyzer
|
|
167
|
+
.pytype/
|
|
168
|
+
|
|
169
|
+
# Cython debug symbols
|
|
170
|
+
cython_debug/
|
|
171
|
+
|
|
172
|
+
# PyCharm
|
|
173
|
+
.idea/
|
|
174
|
+
|
|
175
|
+
# NX
|
|
176
|
+
.nx
|
|
177
|
+
|
|
178
|
+
# Test artifcats
|
|
179
|
+
chroma.sqlite3
|
|
180
|
+
|
|
181
|
+
# Claude
|
|
182
|
+
.claude
|
|
183
|
+
|
|
184
|
+
# Development files
|
|
185
|
+
packages/sample-app/sample_app/development/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: moda-openai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Moda OpenAI instrumentation for LLM observability
|
|
5
|
+
Project-URL: Repository, https://github.com/ModaLabs/moda-python/tree/main/packages/moda-openai
|
|
6
|
+
Author-email: Moda Labs <support@moda.so>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Requires-Python: <4,>=3.10
|
|
9
|
+
Requires-Dist: opentelemetry-api<2,>=1.38.0
|
|
10
|
+
Requires-Dist: opentelemetry-instrumentation>=0.59b0
|
|
11
|
+
Requires-Dist: opentelemetry-semantic-conventions-ai<0.5.0,>=0.4.13
|
|
12
|
+
Requires-Dist: opentelemetry-semantic-conventions>=0.59b0
|
|
13
|
+
Provides-Extra: instruments
|
|
14
|
+
Requires-Dist: openai; extra == 'instruments'
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# OpenTelemetry OpenAI Instrumentation
|
|
18
|
+
|
|
19
|
+
<a href="https://pypi.org/project/opentelemetry-instrumentation-openai/">
|
|
20
|
+
<img src="https://badge.fury.io/py/opentelemetry-instrumentation-openai.svg">
|
|
21
|
+
</a>
|
|
22
|
+
|
|
23
|
+
This library allows tracing OpenAI prompts and completions sent with the official [OpenAI library](https://github.com/openai/openai-python).
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install opentelemetry-instrumentation-openai
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Example usage
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from opentelemetry.instrumentation.openai import OpenAIInstrumentor
|
|
35
|
+
|
|
36
|
+
OpenAIInstrumentor().instrument()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Privacy
|
|
40
|
+
|
|
41
|
+
**By default, this instrumentation logs prompts, completions, and embeddings to span attributes**. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.
|
|
42
|
+
|
|
43
|
+
However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.
|
|
44
|
+
|
|
45
|
+
To disable logging, set the `TRACELOOP_TRACE_CONTENT` environment variable to `false`.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
TRACELOOP_TRACE_CONTENT=false
|
|
49
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# OpenTelemetry OpenAI Instrumentation
|
|
2
|
+
|
|
3
|
+
<a href="https://pypi.org/project/opentelemetry-instrumentation-openai/">
|
|
4
|
+
<img src="https://badge.fury.io/py/opentelemetry-instrumentation-openai.svg">
|
|
5
|
+
</a>
|
|
6
|
+
|
|
7
|
+
This library allows tracing OpenAI prompts and completions sent with the official [OpenAI library](https://github.com/openai/openai-python).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install opentelemetry-instrumentation-openai
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Example usage
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from opentelemetry.instrumentation.openai import OpenAIInstrumentor
|
|
19
|
+
|
|
20
|
+
OpenAIInstrumentor().instrument()
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Privacy
|
|
24
|
+
|
|
25
|
+
**By default, this instrumentation logs prompts, completions, and embeddings to span attributes**. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.
|
|
26
|
+
|
|
27
|
+
However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.
|
|
28
|
+
|
|
29
|
+
To disable logging, set the `TRACELOOP_TRACE_CONTENT` environment variable to `false`.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
TRACELOOP_TRACE_CONTENT=false
|
|
33
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from typing import Callable, Collection, Optional
|
|
2
|
+
|
|
3
|
+
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
|
4
|
+
from opentelemetry.instrumentation.openai.shared.config import Config
|
|
5
|
+
from opentelemetry.instrumentation.openai.utils import is_openai_v1
|
|
6
|
+
from typing_extensions import Coroutine
|
|
7
|
+
|
|
8
|
+
_instruments = ("openai >= 0.27.0",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class OpenAIInstrumentor(BaseInstrumentor):
|
|
12
|
+
"""An instrumentor for OpenAI's client library."""
|
|
13
|
+
|
|
14
|
+
def __init__(
|
|
15
|
+
self,
|
|
16
|
+
enrich_assistant: bool = False,
|
|
17
|
+
exception_logger=None,
|
|
18
|
+
get_common_metrics_attributes: Callable[[], dict] = lambda: {},
|
|
19
|
+
upload_base64_image: Optional[
|
|
20
|
+
Callable[[str, str, str, str], Coroutine[None, None, str]]
|
|
21
|
+
] = lambda *args: "",
|
|
22
|
+
enable_trace_context_propagation: bool = True,
|
|
23
|
+
use_legacy_attributes: bool = True,
|
|
24
|
+
):
|
|
25
|
+
super().__init__()
|
|
26
|
+
Config.enrich_assistant = enrich_assistant
|
|
27
|
+
Config.exception_logger = exception_logger
|
|
28
|
+
Config.get_common_metrics_attributes = get_common_metrics_attributes
|
|
29
|
+
Config.upload_base64_image = upload_base64_image
|
|
30
|
+
Config.enable_trace_context_propagation = enable_trace_context_propagation
|
|
31
|
+
Config.use_legacy_attributes = use_legacy_attributes
|
|
32
|
+
|
|
33
|
+
def instrumentation_dependencies(self) -> Collection[str]:
|
|
34
|
+
return _instruments
|
|
35
|
+
|
|
36
|
+
def _instrument(self, **kwargs):
|
|
37
|
+
if is_openai_v1():
|
|
38
|
+
from opentelemetry.instrumentation.openai.v1 import OpenAIV1Instrumentor
|
|
39
|
+
|
|
40
|
+
OpenAIV1Instrumentor().instrument(**kwargs)
|
|
41
|
+
else:
|
|
42
|
+
from opentelemetry.instrumentation.openai.v0 import OpenAIV0Instrumentor
|
|
43
|
+
|
|
44
|
+
OpenAIV0Instrumentor().instrument(**kwargs)
|
|
45
|
+
|
|
46
|
+
def _uninstrument(self, **kwargs):
|
|
47
|
+
if is_openai_v1():
|
|
48
|
+
from opentelemetry.instrumentation.openai.v1 import OpenAIV1Instrumentor
|
|
49
|
+
|
|
50
|
+
OpenAIV1Instrumentor().uninstrument(**kwargs)
|
|
51
|
+
else:
|
|
52
|
+
from opentelemetry.instrumentation.openai.v0 import OpenAIV0Instrumentor
|
|
53
|
+
|
|
54
|
+
OpenAIV0Instrumentor().uninstrument(**kwargs)
|