diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 189489614a..620b793fc7 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -8,7 +8,7 @@ on: jobs: build: runs-on: ubuntu-latest - + steps: - name: Login to Docker Hub uses: docker/login-action@v3 @@ -17,7 +17,7 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - uses: actions/checkout@v3 - + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -38,4 +38,3 @@ jobs: letta/letta:latest memgpt/letta:${{ env.CURRENT_VERSION }} memgpt/letta:latest - diff --git a/letta/client/client.py b/letta/client/client.py index ae75e9eb1b..3e46d16ffe 100644 --- a/letta/client/client.py +++ b/letta/client/client.py @@ -408,7 +408,8 @@ class RESTClient(AbstractClient): def __init__( self, base_url: str, - token: str, + token: Optional[str] = None, + password: Optional[str] = None, api_prefix: str = "v1", debug: bool = False, default_llm_config: Optional[LLMConfig] = None, @@ -424,11 +425,18 @@ def __init__( default_llm_config (Optional[LLMConfig]): The default LLM configuration. default_embedding_config (Optional[EmbeddingConfig]): The default embedding configuration. headers (Optional[Dict]): The additional headers for the REST API. + token (Optional[str]): The token for the REST API when using managed letta service. + password (Optional[str]): The password for the REST API when using self hosted letta service. """ super().__init__(debug=debug) self.base_url = base_url self.api_prefix = api_prefix - self.headers = {"accept": "application/json", "authorization": f"Bearer {token}"} + if token: + self.headers = {"accept": "application/json", "Authorization": f"Bearer {token}"} + elif password: + self.headers = {"accept": "application/json", "X-BARE-PASSWORD": f"password {password}"} + else: + raise ValueError("Either token or password must be provided") if headers: self.headers.update(headers) self._default_llm_config = default_llm_config diff --git a/letta/functions/schema_generator.py b/letta/functions/schema_generator.py index 6f5bb52f9d..5ba9d2bfdc 100644 --- a/letta/functions/schema_generator.py +++ b/letta/functions/schema_generator.py @@ -3,7 +3,6 @@ from docstring_parser import parse from pydantic import BaseModel -from pydantic.v1 import BaseModel as V1BaseModel def is_optional(annotation): diff --git a/tests/test_tool_sandbox/restaurant_management_system/adjust_menu_prices.py b/tests/test_tool_sandbox/restaurant_management_system/adjust_menu_prices.py index 57adc16395..1e5c090e6b 100644 --- a/tests/test_tool_sandbox/restaurant_management_system/adjust_menu_prices.py +++ b/tests/test_tool_sandbox/restaurant_management_system/adjust_menu_prices.py @@ -8,7 +8,6 @@ def adjust_menu_prices(percentage: float) -> str: str: A formatted string summarizing the price adjustments. """ import cowsay - from core.menu import Menu, MenuItem # Import a class from the codebase from core.utils import format_currency # Use a utility function to test imports