Files
DB-GPT/dbgpt/vis/base.py
明天 d5afa6e206 Native data AI application framework based on AWEL+AGENT (#1152)
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
Co-authored-by: lcx01800250 <lcx01800250@alibaba-inc.com>
Co-authored-by: licunxing <864255598@qq.com>
Co-authored-by: Aralhi <xiaoping0501@gmail.com>
Co-authored-by: xuyuan23 <643854343@qq.com>
Co-authored-by: aries_ckt <916701291@qq.com>
Co-authored-by: hzh97 <2976151305@qq.com>
2024-02-07 17:43:27 +08:00

33 lines
820 B
Python

import json
from abc import ABC, abstractmethod
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Type, Union
from dbgpt.util.json_utils import serialize
class Vis:
def render_prompt(self):
return None
async def generate_param(self, **kwargs) -> Optional[str]:
"""
Display corresponding content using vis protocol
Args:
**kwargs:
Returns:
vis protocol text
"""
return kwargs["content"]
async def disply(self, **kwargs) -> Optional[str]:
return f"```{self.vis_tag()}\n{json.dumps(await self.generate_param(**kwargs), default=serialize, ensure_ascii=False)}\n```"
@classmethod
def vis_tag(cls) -> str:
"""
Current vis protocol module tag name
Returns:
"""