Merge branch 'main' into rajat/DEV-1069
This commit is contained in:
commit
dfa7577eb8
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
---
|
||||
|
||||

|
||||

|
||||
[](https://pypi.org/project/honcho-ai/)
|
||||
[](https://npmjs.org/package/@honcho-ai/sdk)
|
||||
[](https://discord.gg/plasticlabs)
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ client = Honcho(
|
|||
api_key=os.environ["HONCHO_API_KEY"],
|
||||
environment="production",
|
||||
# Create a workspace, otherwise set to "default"
|
||||
# workspace="your-workspace-id"
|
||||
# workspaceId="your-workspace-id"
|
||||
)
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -2932,7 +2932,7 @@ components:
|
|||
properties:
|
||||
content:
|
||||
type: string
|
||||
maxLength: 50000
|
||||
maxLength: 25000
|
||||
minLength: 0
|
||||
title: Content
|
||||
peer_id:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "honcho"
|
||||
version = "2.3.0"
|
||||
version = "2.3.1"
|
||||
description = "Honcho Server"
|
||||
authors = [
|
||||
{name = "Plastic Labs", email = "hello@plasticlabs.ai"},
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ class AppSettings(HonchoSettings):
|
|||
100_000
|
||||
)
|
||||
|
||||
MAX_MESSAGE_SIZE: Annotated[int, Field(default=25_000, gt=0)] = 25_000
|
||||
EMBED_MESSAGES: bool = True
|
||||
MAX_EMBEDDING_TOKENS: Annotated[int, Field(default=8192, gt=0)] = 8192
|
||||
MAX_EMBEDDING_TOKENS_PER_REQUEST: Annotated[int, Field(default=300_000, gt=0)] = (
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from sqlalchemy.sql import func
|
|||
from src.config import settings
|
||||
from src.models import QueueItem
|
||||
|
||||
from .. import exceptions, models
|
||||
from .. import models
|
||||
from ..dependencies import tracked_db
|
||||
from .consumer import process_items
|
||||
|
||||
|
|
@ -278,13 +278,6 @@ class QueueManager:
|
|||
try:
|
||||
raw_payloads = [msg.payload for msg in messages_to_process]
|
||||
await process_items(task_type, raw_payloads)
|
||||
except exceptions.LLMError as e:
|
||||
logger.error(
|
||||
f"LLM returned bad JSON for messages in work unit {work_unit_key}, re-queueing",
|
||||
)
|
||||
if settings.SENTRY.ENABLED:
|
||||
sentry_sdk.capture_exception(e)
|
||||
continue # Don't mark as processed, allow re-queue
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"Error processing tasks for work unit {work_unit_key}: {e}",
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ app = FastAPI(
|
|||
title="Honcho API",
|
||||
summary="The Identity Layer for the Agentic World",
|
||||
description="""Honcho is a platform for giving agents user-centric memory and social cognition""",
|
||||
version="2.3.0",
|
||||
version="2.3.1",
|
||||
contact={
|
||||
"name": "Plastic Labs",
|
||||
"url": "https://honcho.dev",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ from pydantic import (
|
|||
model_validator,
|
||||
)
|
||||
|
||||
from src.config import settings
|
||||
|
||||
RESOURCE_NAME_PATTERN = r"^[a-zA-Z0-9_-]+$"
|
||||
|
||||
|
||||
|
|
@ -114,7 +116,7 @@ class MessageBase(BaseModel):
|
|||
|
||||
|
||||
class MessageCreate(MessageBase):
|
||||
content: Annotated[str, Field(min_length=0, max_length=50000)]
|
||||
content: Annotated[str, Field(min_length=0, max_length=settings.MAX_MESSAGE_SIZE)]
|
||||
peer_name: str = Field(alias="peer_id")
|
||||
metadata: dict[str, Any] | None = None
|
||||
created_at: datetime.datetime | None = None
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from sqlalchemy import Integer, select
|
|||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from src import schemas
|
||||
from src.config import settings
|
||||
from src.exceptions import FileProcessingError, UnsupportedFileTypeError
|
||||
from src.schemas import Message
|
||||
|
||||
|
|
@ -157,7 +158,7 @@ async def get_file_messages(
|
|||
async def process_file_uploads_for_messages(
|
||||
file: UploadFile,
|
||||
peer_id: str,
|
||||
max_chars: int = 49500,
|
||||
max_chars: int = settings.MAX_MESSAGE_SIZE,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""
|
||||
Process an uploaded file and prepare message creation data.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from fastapi.testclient import TestClient
|
||||
from nanoid import generate as generate_nanoid
|
||||
|
||||
from src.config import settings
|
||||
from src.models import Peer, Workspace
|
||||
|
||||
|
||||
|
|
@ -73,14 +74,21 @@ def test_message_validations_api(
|
|||
f"/v2/workspaces/{test_workspace.name}/sessions/{session_id}/messages",
|
||||
json={
|
||||
"messages": [
|
||||
{"content": "a" * 50001, "peer_id": test_peer.name, "metadata": {}}
|
||||
{
|
||||
"content": "a" * (settings.MAX_MESSAGE_SIZE + 1),
|
||||
"peer_id": test_peer.name,
|
||||
"metadata": {},
|
||||
}
|
||||
]
|
||||
},
|
||||
)
|
||||
assert response.status_code == 422
|
||||
error = response.json()["detail"][0]
|
||||
assert "content" in str(error["loc"])
|
||||
assert error["msg"] == "String should have at most 50000 characters"
|
||||
assert (
|
||||
error["msg"]
|
||||
== f"String should have at most {settings.MAX_MESSAGE_SIZE} characters"
|
||||
)
|
||||
assert error["type"] == "string_too_long"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue