From a204b4cb59fd508d830421b549dd19e651c8cb3e Mon Sep 17 00:00:00 2001 From: Rishab Ramanathan Date: Fri, 11 Jul 2025 15:06:18 -0700 Subject: [PATCH 1/3] fix: improve tracing errors --- src/openlayer/lib/tracing/tracer.py | 45 ++++++++++++++++++----------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/openlayer/lib/tracing/tracer.py b/src/openlayer/lib/tracing/tracer.py index d27771ad..1824df97 100644 --- a/src/openlayer/lib/tracing/tracer.py +++ b/src/openlayer/lib/tracing/tracer.py @@ -1,19 +1,20 @@ """Module with the logic to create and manage traces and steps.""" -import time import asyncio +import contextvars import inspect import logging -import contextvars -from typing import Any, Dict, List, Tuple, Optional, Awaitable, Generator -from functools import wraps +import time +import traceback from contextlib import contextmanager +from functools import wraps +from typing import Any, Awaitable, Dict, Generator, List, Optional, Tuple -from . import enums, steps, traces -from .. import utils -from ..._client import Openlayer from ..._base_client import DefaultHttpxClient +from ..._client import Openlayer from ...types.inference_pipelines.data_stream_params import ConfigLlmData +from .. import utils +from . import enums, steps, traces logger = logging.getLogger(__name__) @@ -251,12 +252,14 @@ async def __anext__(self): # Initialize tracing on first iteration only if not self._trace_initialized: self._original_gen = func(*func_args, **func_kwargs) - self._step, self._is_root_step, self._token = _create_and_initialize_step( - step_name=step_name, - step_type=enums.StepType.USER_CALL, - inputs=None, - output=None, - metadata=None, + self._step, self._is_root_step, self._token = ( + _create_and_initialize_step( + step_name=step_name, + step_type=enums.StepType.USER_CALL, + inputs=None, + output=None, + metadata=None, + ) ) self._inputs = _extract_function_inputs( func_signature=func_signature, @@ -466,16 +469,25 @@ def _handle_trace_completion( ) if _publish: try: + inference_pipeline_id = inference_pipeline_id or utils.get_env_variable( + "OPENLAYER_INFERENCE_PIPELINE_ID" + ) client = _get_client() if client: client.inference_pipelines.data.stream( - inference_pipeline_id=inference_pipeline_id - or utils.get_env_variable("OPENLAYER_INFERENCE_PIPELINE_ID"), + inference_pipeline_id=inference_pipeline_id, rows=[trace_data], config=config, ) except Exception as err: # pylint: disable=broad-except - logger.error("Could not stream data to Openlayer %s", err) + logger.error(traceback.format_exc()) + logger.error( + "Could not stream data to Openlayer (pipeline_id: %s, base_url: %s)" + " Error: %s", + inference_pipeline_id, + client.base_url, + err, + ) else: logger.debug("Ending step %s", step_name) @@ -557,7 +569,6 @@ def _finalize_step_logging( # ----------------------------- Async generator specific functions ----------------------------- # - def _finalize_async_generator_step( step: steps.Step, token: Any, From 4166639bd2a0bfb87b429444ba9edeb15d1265fe Mon Sep 17 00:00:00 2001 From: Rishab Ramanathan Date: Fri, 11 Jul 2025 15:08:02 -0700 Subject: [PATCH 2/3] chore: add github PR template --- .github/pull_request_template.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..87d96ed8 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,24 @@ +# Pull Request + +## Summary + + + +## Changes + + + +- [x] Change 1 + +## Context + + + +## Testing + + + +- [ ] Unit tests +- [ ] Manual testing +- [ ] Postman CI/CD +- [ ] Other (please specify) From 9bb6940fa039b23fa262e8258088ac8580c11369 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 22:10:09 +0000 Subject: [PATCH 3/3] release: 0.2.0-alpha.69 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 +- src/openlayer/_version.py | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d3026ab7..2635f9da 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.2.0-alpha.68" + ".": "0.2.0-alpha.69" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 49e480f5..b8ba6d73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 0.2.0-alpha.69 (2025-07-11) + +Full Changelog: [v0.2.0-alpha.68...v0.2.0-alpha.69](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.68...v0.2.0-alpha.69) + +### Bug Fixes + +* improve tracing errors ([a204b4c](https://github.com/openlayer-ai/openlayer-python/commit/a204b4cb59fd508d830421b549dd19e651c8cb3e)) + + +### Chores + +* add github PR template ([4166639](https://github.com/openlayer-ai/openlayer-python/commit/4166639bd2a0bfb87b429444ba9edeb15d1265fe)) + ## 0.2.0-alpha.68 (2025-07-11) Full Changelog: [v0.2.0-alpha.67...v0.2.0-alpha.68](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.67...v0.2.0-alpha.68) diff --git a/pyproject.toml b/pyproject.toml index a329cc38..5f8a9b03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openlayer" -version = "0.2.0-alpha.68" +version = "0.2.0-alpha.69" description = "The official Python library for the openlayer API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/openlayer/_version.py b/src/openlayer/_version.py index f772aba6..790d0fb0 100644 --- a/src/openlayer/_version.py +++ b/src/openlayer/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "openlayer" -__version__ = "0.2.0-alpha.68" # x-release-please-version +__version__ = "0.2.0-alpha.69" # x-release-please-version pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy