File size: 1,329 Bytes
a85c9b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from typing import Optional

from database import Base
from pydantic import BaseModel, Field
from sqlalchemy import Column, Integer, String


class QueryApp(BaseModel):
    query: str = Field("", description="The query that you want to ask the App.")

    model_config = {
        "json_schema_extra": {
            "example": {
                "query": "Who is Elon Musk?",
            }
        }
    }


class SourceApp(BaseModel):
    source: str = Field("", description="The source that you want to add to the App.")
    data_type: Optional[str] = Field("", description="The type of data to add, remove it for autosense.")

    model_config = {"json_schema_extra": {"example": {"source": "https://en.wikipedia.org/wiki/Elon_Musk"}}}


class DeployAppRequest(BaseModel):
    api_key: str = Field("", description="The Embedchain API key for App deployments.")

    model_config = {"json_schema_extra": {"example": {"api_key": "ec-xxx"}}}


class MessageApp(BaseModel):
    message: str = Field("", description="The message that you want to send to the App.")


class DefaultResponse(BaseModel):
    response: str


class AppModel(Base):
    __tablename__ = "apps"

    id = Column(Integer, primary_key=True, index=True)
    app_id = Column(String, unique=True, index=True)
    config = Column(String, unique=True, index=True)