models.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from typing import Optional
  2. from database import Base
  3. from pydantic import BaseModel, Field
  4. from sqlalchemy import Column, Integer, String
  5. class QueryApp(BaseModel):
  6. query: str = Field("", description="The query that you want to ask the App.")
  7. model_config = {
  8. "json_schema_extra": {
  9. "example": {
  10. "query": "Who is Elon Musk?",
  11. }
  12. }
  13. }
  14. class SourceApp(BaseModel):
  15. source: str = Field("", description="The source that you want to add to the App.")
  16. data_type: Optional[str] = Field("", description="The type of data to add, remove it for autosense.")
  17. model_config = {"json_schema_extra": {"example": {"source": "https://en.wikipedia.org/wiki/Elon_Musk"}}}
  18. class DeployAppRequest(BaseModel):
  19. api_key: str = Field("", description="The Embedchain API key for App deployments.")
  20. model_config = {"json_schema_extra": {"example": {"api_key": "ec-xxx"}}}
  21. class MessageApp(BaseModel):
  22. message: str = Field("", description="The message that you want to send to the App.")
  23. class DefaultResponse(BaseModel):
  24. response: str
  25. class AppModel(Base):
  26. __tablename__ = "apps"
  27. id = Column(Integer, primary_key=True, index=True)
  28. app_id = Column(String, unique=True, index=True)
  29. config = Column(String, unique=True, index=True)