graphiti/server/graph_service/dto/retrieve.py
Pavlo Paliychuk ba48f64492
Add Fastapi graph service (#88)
* chore: Folder rearrangement

* chore: Remove unused deps, and add mypy step in CI for graph-service

* fix: Mypy errors

* fix: linter

* fix mypy

* fix mypy

* chore: Update docker setup

* chore: Reduce graph service image size

* chore: Install graph service deps on CI

* remove cache from typecheck

* chore: install graph-service deps on typecheck action

* update graph service mypy direction

* feat: Add release service image step

* chore: Update depot configuration

* chore: Update release image job to run on releases

* chore: Test depot multiplatform build

* update release action tag

* chore: Update action to be in accordance with zep image publish

* test

* test

* revert

* chore: Update python slim image used in service docker

* chore: Remove unused endpoints and dtos
2024-09-06 11:07:45 -04:00

41 lines
1.2 KiB
Python

from datetime import datetime
from typing import Literal
from pydantic import BaseModel, Field
from graph_service.dto.common import Message
class SearchQuery(BaseModel):
group_id: str = Field(..., description='The group id of the memory to get')
query: str
max_facts: int = Field(default=10, description='The maximum number of facts to retrieve')
search_type: Literal['facts', 'user_centered_facts'] = Field(
default='facts', description='The type of search to perform'
)
class FactResult(BaseModel):
uuid: str
name: str
fact: str
valid_at: datetime | None
invalid_at: datetime | None
created_at: datetime
expired_at: datetime | None
class SearchResults(BaseModel):
facts: list[FactResult]
class GetMemoryRequest(BaseModel):
group_id: str = Field(..., description='The group id of the memory to get')
max_facts: int = Field(default=10, description='The maximum number of facts to retrieve')
messages: list[Message] = Field(
..., description='The messages to build the retrieval query from '
)
class GetMemoryResponse(BaseModel):
facts: list[FactResult] = Field(..., description='The facts that were retrieved from the graph')