zhaoqingang
2024-11-11 c1768114de381e37e272e9faf7db8e95a93ff381
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
from datetime import datetime
from enum import IntEnum
from typing import Optional
 
from sqlalchemy import Column, Integer, String, DateTime, Enum, Index, Table, ForeignKey
from pydantic import BaseModel
from sqlalchemy.orm import relationship, backref
 
from app.models.base_model import Base
 
class CommonLlmModel(Base):
    __tablename__ = 'common_llm'
    __mapper_args__ = {
        # "order_by": 'SEQ'
    }
 
    id = Column(String(36), primary_key=True, nullable=False)
    llm_factory = Column(String(128), nullable=False)
    model_type = Column(String(128), nullable=False)
    llm_name = Column(String(128), nullable=False)
    api_key = Column(String(1024), nullable=True)
    api_base = Column(String(255), nullable=True)
 
    def to_json(self):
        json = {
            'id': self.ID,
            'llm_factory': self.llm_factory,
            'model_type': self.model_type,
            'llm_name': self.llm_name,
            'api_key': self.api_key,
            'api_base': self.api_base,
        }
        return json