Skip to content

Commit

Permalink
switched UUIDEncoder with CustomJSONEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
alt-glitch committed May 27, 2024
1 parent 5e36e05 commit ee589df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
8 changes: 0 additions & 8 deletions agents-api/agents_api/clients/worker/types.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
from typing import Callable, Literal, Optional, Protocol
from uuid import UUID
import json
from pydantic import BaseModel


class UUIDEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, UUID):
return str(obj)
return super().default(obj)


class PromptModule(Protocol):
stop: list[str]
temperature: float
Expand Down
5 changes: 3 additions & 2 deletions agents-api/agents_api/routers/sessions/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
from ...autogen.openapi_model import InputChatMLMessage, Tool, DocIds
from ...clients.embed import embed
from ...clients.temporal import run_summarization_task
from ...clients.worker.types import ChatML, UUIDEncoder
from ...clients.worker.types import ChatML
from ...common.exceptions.sessions import SessionNotFoundError
from ...common.protocol.entries import Entry
from ...common.protocol.sessions import SessionData
from ...common.utils.template import render_template
from ...common.utils.json import CustomJSONEncoder
from ...env import (
summarization_tokens_threshold,
docs_embedding_service_url,
Expand Down Expand Up @@ -65,7 +66,7 @@ async def wrapper(
"init_context": [c.model_dump() for c in init_context],
"settings": settings.model_dump(),
},
cls=UUIDEncoder,
cls=CustomJSONEncoder, default_empty_value="",
)
).hexdigest()
result = get_cached_response(key=key)
Expand Down

0 comments on commit ee589df

Please sign in to comment.