| 1234567891011121314151617 |
- import re
- from llama_index.llms.litellm import LiteLLM
- from src.manager.template_manager import TemplateManager, TemplateService, TemplateType
- class BaseAgent:
- def __init__(self, llm:LiteLLM, template_manager:TemplateManager):
- self.llm = llm
- self.template_manager = template_manager
-
- def filter_markdown_content(self, llm_str: str):
- pattern = r'```markdown(.*?)```'
- matches = re.findall(pattern, llm_str, re.DOTALL)
- if not matches:
- markdown = llm_str
- else:
- markdown = matches[0]
- return markdown
|