beamlit 0.0.22rc11__py3-none-any.whl → 0.0.23rc13__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.
- beamlit/agents/chat.py +2 -1
- beamlit/agents/decorator.py +7 -2
- beamlit/authentication/authentication.py +0 -1
- beamlit/authentication/credentials.py +1 -1
- beamlit/client.py +0 -1
- beamlit/common/settings.py +12 -11
- beamlit/functions/decorator.py +5 -10
- beamlit/serve/app.py +0 -1
- {beamlit-0.0.22rc11.dist-info → beamlit-0.0.23rc13.dist-info}/METADATA +1 -1
- {beamlit-0.0.22rc11.dist-info → beamlit-0.0.23rc13.dist-info}/RECORD +11 -11
- {beamlit-0.0.22rc11.dist-info → beamlit-0.0.23rc13.dist-info}/WHEEL +0 -0
    
        beamlit/agents/chat.py
    CHANGED
    
    | @@ -37,12 +37,13 @@ def get_chat_model(agent_model: AgentDeployment): | |
| 37 37 | 
             
                headers = get_authentication_headers(settings)
         | 
| 38 38 | 
             
                headers["X-Beamlit-Environment"] = agent_model.environment
         | 
| 39 39 |  | 
| 40 | 
            -
                jwt = headers. | 
| 40 | 
            +
                jwt = headers.get("X-Beamlit-Authorization", "").replace("Bearer ", "")
         | 
| 41 41 | 
             
                params = {"environment": agent_model.environment}
         | 
| 42 42 | 
             
                chat_classes = {
         | 
| 43 43 | 
             
                    "openai": {
         | 
| 44 44 | 
             
                        "func": get_openai_chat_model,
         | 
| 45 45 | 
             
                        "kwargs": {
         | 
| 46 | 
            +
                            "http_async_client": client.get_async_httpx_client(),
         | 
| 46 47 | 
             
                            "http_client": client.get_httpx_client(),
         | 
| 47 48 | 
             
                        },
         | 
| 48 49 | 
             
                    },
         | 
    
        beamlit/agents/decorator.py
    CHANGED
    
    | @@ -1,9 +1,11 @@ | |
| 1 1 | 
             
            # Import necessary modules
         | 
| 2 2 | 
             
            import ast
         | 
| 3 | 
            +
            import asyncio
         | 
| 3 4 | 
             
            import importlib
         | 
| 4 5 | 
             
            import os
         | 
| 5 6 | 
             
            from logging import getLogger
         | 
| 6 7 |  | 
| 8 | 
            +
            from langchain_core.tools import Tool
         | 
| 7 9 | 
             
            from langgraph.checkpoint.memory import MemorySaver
         | 
| 8 10 | 
             
            from langgraph.prebuilt import create_react_agent
         | 
| 9 11 |  | 
| @@ -35,7 +37,7 @@ def get_functions(dir="src/functions", from_decorator="function"): | |
| 35 37 | 
             
                                    # Look for function definitions with decorators
         | 
| 36 38 | 
             
                                    for node in ast.walk(tree):
         | 
| 37 39 | 
             
                                        if (
         | 
| 38 | 
            -
                                            not isinstance(node, ast.FunctionDef)
         | 
| 40 | 
            +
                                            (not isinstance(node, ast.FunctionDef) and not isinstance(node, ast.AsyncFunctionDef))
         | 
| 39 41 | 
             
                                            or len(node.decorator_list) == 0
         | 
| 40 42 | 
             
                                        ):
         | 
| 41 43 | 
             
                                            continue
         | 
| @@ -73,7 +75,10 @@ def get_functions(dir="src/functions", from_decorator="function"): | |
| 73 75 | 
             
                                            # Get the decorated function
         | 
| 74 76 | 
             
                                            if not is_kit and hasattr(module, func_name):
         | 
| 75 77 | 
             
                                                func = getattr(module, func_name)
         | 
| 76 | 
            -
                                                 | 
| 78 | 
            +
                                                if asyncio.iscoroutinefunction(func):
         | 
| 79 | 
            +
                                                    functions.append(Tool(name=func.__name__, description=func.__doc__, func=func, coroutine=func))
         | 
| 80 | 
            +
                                                else:
         | 
| 81 | 
            +
                                                    functions.append(Tool(name=func.__name__, description=func.__doc__, func=func))
         | 
| 77 82 | 
             
                                except Exception as e:
         | 
| 78 83 | 
             
                                    logger.warning(f"Error processing {file_path}: {e!s}")
         | 
| 79 84 | 
             
                return functions
         | 
| @@ -130,7 +130,7 @@ def load_credentials(workspace_name: str) -> Credentials: | |
| 130 130 | 
             
            def load_credentials_from_settings(settings: Settings) -> Credentials:
         | 
| 131 131 | 
             
                return Credentials(
         | 
| 132 132 | 
             
                    api_key=settings.authentication.api_key,
         | 
| 133 | 
            -
                    client_credentials=settings.authentication. | 
| 133 | 
            +
                    client_credentials=settings.authentication.client.credentials,
         | 
| 134 134 | 
             
                )
         | 
| 135 135 |  | 
| 136 136 |  | 
    
        beamlit/client.py
    CHANGED
    
    | @@ -248,7 +248,6 @@ class AuthenticatedClient: | |
| 248 248 | 
             
                def get_async_httpx_client(self) -> httpx.AsyncClient:
         | 
| 249 249 | 
             
                    """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
         | 
| 250 250 | 
             
                    if self._async_client is None:
         | 
| 251 | 
            -
                        self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
         | 
| 252 251 | 
             
                        self._async_client = httpx.AsyncClient(
         | 
| 253 252 | 
             
                            base_url=self._base_url,
         | 
| 254 253 | 
             
                            cookies=self._cookies,
         | 
    
        beamlit/common/settings.py
    CHANGED
    
    | @@ -2,16 +2,6 @@ import os | |
| 2 2 | 
             
            from logging import getLogger
         | 
| 3 3 | 
             
            from typing import List, Tuple, Type, Union
         | 
| 4 4 |  | 
| 5 | 
            -
            from langchain_core.language_models.chat_models import BaseChatModel
         | 
| 6 | 
            -
            from langgraph.graph.graph import CompiledGraph
         | 
| 7 | 
            -
            from pydantic import Field
         | 
| 8 | 
            -
            from pydantic_settings import (
         | 
| 9 | 
            -
                BaseSettings,
         | 
| 10 | 
            -
                PydanticBaseSettingsSource,
         | 
| 11 | 
            -
                SettingsConfigDict,
         | 
| 12 | 
            -
                YamlConfigSettingsSource,
         | 
| 13 | 
            -
            )
         | 
| 14 | 
            -
             | 
| 15 5 | 
             
            from beamlit.api.functions import get_function_deployment
         | 
| 16 6 | 
             
            from beamlit.api.models import get_model_deployment
         | 
| 17 7 | 
             
            from beamlit.client import AuthenticatedClient
         | 
| @@ -20,6 +10,11 @@ from beamlit.models.agent_deployment import AgentDeployment | |
| 20 10 | 
             
            from beamlit.models.function_deployment import FunctionDeployment
         | 
| 21 11 | 
             
            from beamlit.models.model_deployment import ModelDeployment
         | 
| 22 12 | 
             
            from beamlit.types import UNSET, Unset
         | 
| 13 | 
            +
            from langchain_core.language_models.chat_models import BaseChatModel
         | 
| 14 | 
            +
            from langgraph.graph.graph import CompiledGraph
         | 
| 15 | 
            +
            from pydantic import Field
         | 
| 16 | 
            +
            from pydantic_settings import (BaseSettings, PydanticBaseSettingsSource,
         | 
| 17 | 
            +
                                           SettingsConfigDict, YamlConfigSettingsSource)
         | 
| 23 18 |  | 
| 24 19 | 
             
            global SETTINGS
         | 
| 25 20 | 
             
            SETTINGS = None
         | 
| @@ -39,10 +34,14 @@ class SettingsAgent(BaseSettings): | |
| 39 34 | 
             
                module: str = Field(default="main.main")
         | 
| 40 35 |  | 
| 41 36 |  | 
| 37 | 
            +
            class SettingsAuthenticationClient(BaseSettings):
         | 
| 38 | 
            +
                credentials: Union[None, str] = None
         | 
| 39 | 
            +
             | 
| 40 | 
            +
             | 
| 42 41 | 
             
            class SettingsAuthentication(BaseSettings):
         | 
| 43 42 | 
             
                api_key: Union[None, str] = None
         | 
| 44 43 | 
             
                jwt: Union[None, str] = None
         | 
| 45 | 
            -
                 | 
| 44 | 
            +
                client: SettingsAuthenticationClient = SettingsAuthenticationClient()
         | 
| 46 45 |  | 
| 47 46 |  | 
| 48 47 | 
             
            class SettingsServer(BaseSettings):
         | 
| @@ -56,10 +55,12 @@ class Settings(BaseSettings): | |
| 56 55 | 
             
                    yaml_file="beamlit.yaml",
         | 
| 57 56 | 
             
                    env_prefix="bl_",
         | 
| 58 57 | 
             
                    env_nested_delimiter="_",
         | 
| 58 | 
            +
                    extra="ignore",
         | 
| 59 59 | 
             
                )
         | 
| 60 60 |  | 
| 61 61 | 
             
                workspace: str
         | 
| 62 62 | 
             
                environment: str = Field(default="production")
         | 
| 63 | 
            +
                remote: bool = Field(default=False)
         | 
| 63 64 | 
             
                type: str = Field(default="agent")
         | 
| 64 65 | 
             
                name: str = Field(default="beamlit-agent")
         | 
| 65 66 | 
             
                base_url: str = Field(default="https://api.beamlit.dev/v0")
         | 
    
        beamlit/functions/decorator.py
    CHANGED
    
    | @@ -3,12 +3,11 @@ | |
| 3 3 | 
             
            from collections.abc import Callable
         | 
| 4 4 | 
             
            from logging import getLogger
         | 
| 5 5 |  | 
| 6 | 
            -
            from langchain_core.tools import create_schema_from_function, tool
         | 
| 7 | 
            -
             | 
| 8 6 | 
             
            from beamlit.authentication import new_client
         | 
| 9 7 | 
             
            from beamlit.common.settings import get_settings
         | 
| 10 8 | 
             
            from beamlit.models import FunctionDeployment, FunctionKit
         | 
| 11 9 | 
             
            from beamlit.run import RunClient
         | 
| 10 | 
            +
            from langchain_core.tools import create_schema_from_function
         | 
| 12 11 |  | 
| 13 12 | 
             
            logger = getLogger(__name__)
         | 
| 14 13 |  | 
| @@ -58,7 +57,7 @@ def kit(bl_kit: FunctionKit = None, **kwargs: dict) -> Callable: | |
| 58 57 | 
             
                def wrapper(func: Callable) -> Callable:
         | 
| 59 58 | 
             
                    if bl_kit and not func.__doc__ and bl_kit.description:
         | 
| 60 59 | 
             
                        func.__doc__ = bl_kit.description
         | 
| 61 | 
            -
                    return  | 
| 60 | 
            +
                    return func
         | 
| 62 61 |  | 
| 63 62 | 
             
                return wrapper
         | 
| 64 63 |  | 
| @@ -72,10 +71,7 @@ def function( | |
| 72 71 | 
             
                def wrapper(func: Callable) -> Callable:
         | 
| 73 72 | 
             
                    if bl_function and not func.__doc__ and bl_function.description:
         | 
| 74 73 | 
             
                        func.__doc__ = bl_function.description
         | 
| 75 | 
            -
                    if  | 
| 76 | 
            -
                        settings.environment == "development"
         | 
| 77 | 
            -
                        or settings.environment == "production"
         | 
| 78 | 
            -
                    ):
         | 
| 74 | 
            +
                    if settings.remote:
         | 
| 79 75 | 
             
                        remote_func = get_remote_function(func, bl_function)
         | 
| 80 76 | 
             
                        if not kwargs.get("args_schema"):
         | 
| 81 77 | 
             
                            kwargs["args_schema"] = create_schema_from_function(
         | 
| @@ -83,8 +79,7 @@ def function( | |
| 83 79 | 
             
                                func,
         | 
| 84 80 | 
             
                                parse_docstring=func.__doc__,
         | 
| 85 81 | 
             
                            )
         | 
| 86 | 
            -
                        return  | 
| 87 | 
            -
                    return  | 
| 82 | 
            +
                        return remote_func
         | 
| 83 | 
            +
                    return func
         | 
| 88 84 |  | 
| 89 85 | 
             
                return wrapper
         | 
| 90 | 
            -
                return wrapper
         | 
    
        beamlit/serve/app.py
    CHANGED
    
    | @@ -16,7 +16,6 @@ from .middlewares import AccessLogMiddleware, AddProcessTimeHeader | |
| 16 16 | 
             
            sys.path.insert(0, os.getcwd())
         | 
| 17 17 | 
             
            sys.path.insert(0, os.path.join(os.getcwd(), "src"))
         | 
| 18 18 |  | 
| 19 | 
            -
             | 
| 20 19 | 
             
            def import_module():
         | 
| 21 20 | 
             
                settings = get_settings()
         | 
| 22 21 | 
             
                main_module = importlib.import_module(".".join(settings.server.module.split(".")[0:-1]))
         | 
| @@ -1,12 +1,12 @@ | |
| 1 1 | 
             
            beamlit/__init__.py,sha256=545gFC-wLLwUktWcOAjUWe_Glha40tBetRTOYSfHnbI,164
         | 
| 2 | 
            -
            beamlit/client.py,sha256= | 
| 2 | 
            +
            beamlit/client.py,sha256=OdRbs5VVHF32HUd5RMcnkhe8YxamnAmgGlxO6pm1Xac,12431
         | 
| 3 3 | 
             
            beamlit/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
         | 
| 4 4 | 
             
            beamlit/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
         | 
| 5 5 | 
             
            beamlit/run.py,sha256=y61iDBaR0917ihj5q-cJ_r3BFW1Rn5K_kDAISw5O6aU,1339
         | 
| 6 6 | 
             
            beamlit/types.py,sha256=E1hhDh_zXfsSQ0NCt9-uw90_Mr5iIlsdfnfvxv5HarU,1005
         | 
| 7 7 | 
             
            beamlit/agents/__init__.py,sha256=nf1iwQwGtCG6nDqyVhxfWoqR6dv6X3bvSpCeqkTCFaM,101
         | 
| 8 | 
            -
            beamlit/agents/chat.py,sha256= | 
| 9 | 
            -
            beamlit/agents/decorator.py,sha256= | 
| 8 | 
            +
            beamlit/agents/chat.py,sha256=aI7pObyywRyg3dBpubzHAUWTbTk1nwtxvpY7iIP1RLY,2704
         | 
| 9 | 
            +
            beamlit/agents/decorator.py,sha256=sN-JsLaPwiL-zzH5eZak76y3ObluIy8NFC3xpHFcDWc,6469
         | 
| 10 10 | 
             
            beamlit/api/__init__.py,sha256=zTSiG_ujSjAqWPyc435YXaX9XTlpMjiJWBbV-f-YtdA,45
         | 
| 11 11 | 
             
            beamlit/api/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 12 12 | 
             
            beamlit/api/agents/create_agent.py,sha256=HFExosu02JZqZz7I6U6WjN81TERz6p2i8CzQCyiRYXo,4112
         | 
| @@ -130,18 +130,18 @@ beamlit/api/workspaces/update_workspace.py,sha256=qa5DV2UJSUYuB_ibALb4E9ghKpT1Ha | |
| 130 130 | 
             
            beamlit/api/workspaces/update_workspace_user_role.py,sha256=Yn9iuJ4tKtauzBiJyU4-wYUMS9g98X2Om8zs7UkzrY8,4917
         | 
| 131 131 | 
             
            beamlit/authentication/__init__.py,sha256=wiXqRbc7E-ulrH_ueA9duOGFvXeo7-RvhSD1XbFogMo,1020
         | 
| 132 132 | 
             
            beamlit/authentication/apikey.py,sha256=jnz1FMRauI5qAInqeeDER8aCONx4O8ZPZGedvi3Ap_o,659
         | 
| 133 | 
            -
            beamlit/authentication/authentication.py,sha256= | 
| 133 | 
            +
            beamlit/authentication/authentication.py,sha256=tZu8GoVueKDuq1RLXMvtHcV95XLikmQ19PCxLWBn2Ek,3120
         | 
| 134 134 | 
             
            beamlit/authentication/clientcredentials.py,sha256=6kbfTjwUkXUArJX8XZLe9ZzbEicQc19tSXBvsTpiXMk,3954
         | 
| 135 | 
            -
            beamlit/authentication/credentials.py,sha256= | 
| 135 | 
            +
            beamlit/authentication/credentials.py,sha256=DlfiF_FfOosPVsRoa39JSR3XoICmhBqTlHXc6b4zWtE,5349
         | 
| 136 136 | 
             
            beamlit/authentication/device_mode.py,sha256=oQVBCDsq-pdeXF31WSTAAEdaX6eACV7SYcOSyf3ea_Q,3728
         | 
| 137 137 | 
             
            beamlit/common/__init__.py,sha256=yDoMJDKj-xjTGl7U1YI59KpWxiOV65HSiUulgO8xdTA,277
         | 
| 138 138 | 
             
            beamlit/common/generate.py,sha256=VJ_MiRDulXdQdnlKdM4_Bod6CO6DOGlFiosGXOLuLGs,7227
         | 
| 139 139 | 
             
            beamlit/common/logger.py,sha256=ayabnsoHS8ncXm8EpBS01FkvSe0XRcaNdQjKVuPI5z4,1025
         | 
| 140 140 | 
             
            beamlit/common/secrets.py,sha256=sid81bOe3LflkMKDHwBsBs9nIju8bp5-v9qU9gkyNMc,212
         | 
| 141 | 
            -
            beamlit/common/settings.py,sha256= | 
| 141 | 
            +
            beamlit/common/settings.py,sha256=cL5HAg6atxnTJXL9Rxz5Xs4iApNCCYY5ijha8UM3PW4,5446
         | 
| 142 142 | 
             
            beamlit/common/utils.py,sha256=jouz5igBvT37Xn_e94-foCHyQczVim-UzVcoIF6RWJ4,657
         | 
| 143 143 | 
             
            beamlit/functions/__init__.py,sha256=_RPG1Bfg54JGdIPnViAU6n9zD7E1cDNsdXi8oYGskzE,138
         | 
| 144 | 
            -
            beamlit/functions/decorator.py,sha256 | 
| 144 | 
            +
            beamlit/functions/decorator.py,sha256=uYZOVxD-7ZNHORTQfCIn0qdNKPIZupsr7_QdUmWEKu0,2996
         | 
| 145 145 | 
             
            beamlit/functions/github/__init__.py,sha256=gYnUkeegukOfbymdabuuJkScvH-_ZJygX05BoqkPn0o,49
         | 
| 146 146 | 
             
            beamlit/functions/github/github.py,sha256=FajzLCNkpXcwfgnC0l9rOGT2eSPLCz8-qrMzK9N_ZNc,598
         | 
| 147 147 | 
             
            beamlit/functions/github/kit/__init__.py,sha256=jBwPqZv6C23_utukohxqXZwrlicNlI7PYPUj0Den7Cw,136
         | 
| @@ -292,10 +292,10 @@ beamlit/models/websocket_channel.py,sha256=tyNtsVR0cOwd6BK--ehBCH8bIjxtyPhiAkrxY | |
| 292 292 | 
             
            beamlit/models/workspace.py,sha256=s7wS6ibswosB0FdUb3ry3BnlLa325axBdYPLI3ipe0Q,3986
         | 
| 293 293 | 
             
            beamlit/models/workspace_labels.py,sha256=WbnUY6eCTkUNdY7hhhSF-KQCl8fWFfkCf7hzCTiNp4A,1246
         | 
| 294 294 | 
             
            beamlit/models/workspace_user.py,sha256=70CcifQWYbeWG7TDui4pblTzUe5sVK0AS19vNCzKE8g,3423
         | 
| 295 | 
            -
            beamlit/serve/app.py,sha256 | 
| 295 | 
            +
            beamlit/serve/app.py,sha256=_0ZesKcczd1sYm8vs3ulbXO1M1boO_5DhFf3jSmjM4g,2398
         | 
| 296 296 | 
             
            beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
         | 
| 297 297 | 
             
            beamlit/serve/middlewares/accesslog.py,sha256=wM52-hcwtO-_hdM1pnsEJzerzJf1MzEyN5m85BdDccE,609
         | 
| 298 298 | 
             
            beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
         | 
| 299 | 
            -
            beamlit-0.0. | 
| 300 | 
            -
            beamlit-0.0. | 
| 301 | 
            -
            beamlit-0.0. | 
| 299 | 
            +
            beamlit-0.0.23rc13.dist-info/METADATA,sha256=pgkuT087O9yvCPPpcE64DjtxW5PcTcqBPA5oToxGwFk,2027
         | 
| 300 | 
            +
            beamlit-0.0.23rc13.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
         | 
| 301 | 
            +
            beamlit-0.0.23rc13.dist-info/RECORD,,
         | 
| 
            File without changes
         |