fix: update authorization header to use X-BARE-PASSWORD format (#2338)

This commit is contained in:
Sarah Wooders
2025-01-20 11:21:51 -08:00
committed by GitHub
3 changed files with 12 additions and 6 deletions

View File

@@ -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

View File

@@ -410,7 +410,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,
@@ -426,11 +427,18 @@ class RESTClient(AbstractClient):
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

View File

@@ -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