Skip to content

Commit

Permalink
Fix favicon and remove metadata from schema
Browse files Browse the repository at this point in the history
  • Loading branch information
VVoruganti committed Mar 21, 2024
1 parent 6c92681 commit 640b6c1
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 23 deletions.
30 changes: 15 additions & 15 deletions api/src/schemas.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime
import uuid

from pydantic import BaseModel, validator
from pydantic import BaseModel, Field, validator


class AppBase(BaseModel):
Expand All @@ -21,7 +21,7 @@ class AppUpdate(AppBase):
class App(AppBase):
id: uuid.UUID
name: str
h_metadata: dict
h_metadata: dict = Field(exclude=True)
metadata: dict
created_at: datetime.datetime

Expand All @@ -33,7 +33,7 @@ def fetch_h_metadata(cls, value, values):

class Config:
from_attributes = True
schema_extra = {"exclude": ["h_metadata"]}
json_schema_extra = {"exclude": ["h_metadata"]}


class UserBase(BaseModel):
Expand All @@ -54,7 +54,7 @@ class User(UserBase):
id: uuid.UUID
app_id: uuid.UUID
created_at: datetime.datetime
h_metadata: dict
h_metadata: dict = Field(exclude=True)
metadata: dict

@validator("metadata", pre=True, allow_reuse=True)
Expand All @@ -65,7 +65,7 @@ def fetch_h_metadata(cls, value, values):

class Config:
from_attributes = True
schema_extra = {"exclude": ["h_metadata"]}
json_schema_extra = {"exclude": ["h_metadata"]}


class MessageBase(BaseModel):
Expand All @@ -87,7 +87,7 @@ class Message(MessageBase):
is_user: bool
session_id: uuid.UUID
id: uuid.UUID
h_metadata: dict
h_metadata: dict = Field(exclude=True)
metadata: dict
created_at: datetime.datetime

Expand All @@ -99,7 +99,7 @@ def fetch_h_metadata(cls, value, values):

class Config:
from_attributes = True
schema_extra = {"exclude": ["h_metadata"]}
json_schema_extra = {"exclude": ["h_metadata"]}


class SessionBase(BaseModel):
Expand All @@ -121,7 +121,7 @@ class Session(SessionBase):
is_active: bool
user_id: uuid.UUID
location_id: str
h_metadata: dict
h_metadata: dict = Field(exclude=True)
metadata: dict
created_at: datetime.datetime

Expand All @@ -133,7 +133,7 @@ def fetch_h_metadata(cls, value, values):

class Config:
from_attributes = True
schema_extra = {"exclude": ["h_metadata"]}
json_schema_extra = {"exclude": ["h_metadata"]}


class MetamessageBase(BaseModel):
Expand All @@ -158,7 +158,7 @@ class Metamessage(MetamessageBase):
content: str
id: uuid.UUID
message_id: uuid.UUID
h_metadata: dict
h_metadata: dict = Field(exclude=True)
metadata: dict
created_at: datetime.datetime

Expand All @@ -170,7 +170,7 @@ def fetch_h_metadata(cls, value, values):

class Config:
from_attributes = True
schema_extra = {"exclude": ["h_metadata"]}
json_schema_extra = {"exclude": ["h_metadata"]}


class CollectionBase(BaseModel):
Expand All @@ -191,7 +191,7 @@ class Collection(CollectionBase):
id: uuid.UUID
name: str
user_id: uuid.UUID
h_metadata: dict
h_metadata: dict = Field(exclude=True)
metadata: dict
created_at: datetime.datetime

Expand All @@ -203,7 +203,7 @@ def fetch_h_metadata(cls, value, values):

class Config:
from_attributes = True
schema_extra = {"exclude": ["h_metadata"]}
json_schema_extra = {"exclude": ["h_metadata"]}


class DocumentBase(BaseModel):
Expand All @@ -222,7 +222,7 @@ class DocumentUpdate(DocumentBase):
class Document(DocumentBase):
id: uuid.UUID
content: str
h_metadata: dict
h_metadata: dict = Field(exclude=True)
metadata: dict
created_at: datetime.datetime
collection_id: uuid.UUID
Expand All @@ -235,7 +235,7 @@ def fetch_h_metadata(cls, value, values):

class Config:
from_attributes = True
schema_extra = {"exclude": ["h_metadata"]}
json_schema_extra = {"exclude": ["h_metadata"]}


class AgentChat(BaseModel):
Expand Down
28 changes: 28 additions & 0 deletions sdk/docs/_static/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions sdk/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@

html_theme = "furo"
html_static_path = ["_static"]

html_favicon = "_static/favicon.svg"
12 changes: 4 additions & 8 deletions sdk/tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import pytest

from honcho import (
Document,
GetDocumentPage,
GetMessagePage,
GetMetamessagePage,
GetSessionPage,
Session,
Document,
Message,
Metamessage,
Session,
)
from honcho import Honcho as Honcho

Expand Down Expand Up @@ -251,9 +251,7 @@ def test_paginated_messages():
created_session.create_message(is_user=False, content="Hi")

page_size = 7
get_message_response = created_session.get_messages(
page=1, page_size=page_size
)
get_message_response = created_session.get_messages(page=1, page_size=page_size)

assert get_message_response is not None
assert isinstance(get_message_response, GetMessagePage)
Expand Down Expand Up @@ -448,9 +446,7 @@ def test_collection_query():
collection = user.create_collection(col_name)

# Add documents
doc1 = collection.create_document(
content="The user loves puppies", metadata={}
)
doc1 = collection.create_document(content="The user loves puppies", metadata={})
doc2 = collection.create_document(content="The user owns a dog", metadata={})
doc3 = collection.create_document(content="The user is a doctor", metadata={})

Expand Down

0 comments on commit 640b6c1

Please sign in to comment.