Merge branch 'main' into rajat/DEV-1069

This commit is contained in:
Rajat Ahuja 2025-09-19 11:59:51 -04:00
commit dfa7577eb8
11 changed files with 23 additions and 18 deletions

View File

@ -8,7 +8,7 @@
---
![Static Badge](https://img.shields.io/badge/Version-2.3.0-blue)
![Static Badge](https://img.shields.io/badge/Version-2.3.1-blue)
[![PyPI version](https://img.shields.io/pypi/v/honcho-ai.svg)](https://pypi.org/project/honcho-ai/)
[![NPM version](https://img.shields.io/npm/v/@honcho-ai/sdk.svg)](https://npmjs.org/package/@honcho-ai/sdk)
[![Discord](https://img.shields.io/discord/1016845111637839922?style=flat&logo=discord&logoColor=23ffffff&label=Plastic%20Labs&labelColor=235865F2)](https://discord.gg/plasticlabs)

View File

@ -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"
)
```

View File

@ -2932,7 +2932,7 @@ components:
properties:
content:
type: string
maxLength: 50000
maxLength: 25000
minLength: 0
title: Content
peer_id:

View File

@ -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"},

View File

@ -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)] = (

View File

@ -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}",

View File

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

View File

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

View File

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

View File

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

View File

@ -828,7 +828,7 @@ wheels = [
[[package]]
name = "honcho"
version = "2.3.0"
version = "2.3.1"
source = { virtual = "." }
dependencies = [
{ name = "alembic" },