fix: removes datetime tool and provide it directly
This commit is contained in:
parent
ac6dcd82bb
commit
c5b255a3c8
2 changed files with 16 additions and 6 deletions
|
|
@ -1,7 +1,8 @@
|
|||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from models.llm_message import LLMSystemMessage, LLMUserMessage
|
||||
from models.llm_tools import GetCurrentDatetimeTool, SearchWebTool
|
||||
from models.llm_tools import SearchWebTool
|
||||
from services.llm_client import LLMClient
|
||||
from utils.get_dynamic_models import get_presentation_outline_model_with_n_slides
|
||||
from utils.llm_provider import get_model
|
||||
|
|
@ -26,6 +27,7 @@ def get_user_prompt(prompt: str, n_slides: int, language: str, content: str):
|
|||
- Prompt: {prompt}
|
||||
- Output Language: {language}
|
||||
- Number of Slides: {n_slides}
|
||||
- Current Date and Time: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
||||
- Additional Information: {content}
|
||||
"""
|
||||
|
||||
|
|
@ -52,13 +54,11 @@ async def generate_ppt_outline(
|
|||
|
||||
client = LLMClient()
|
||||
|
||||
tools = [SearchWebTool, GetCurrentDatetimeTool]
|
||||
|
||||
async for chunk in client.stream_structured(
|
||||
model,
|
||||
get_messages(prompt, n_slides, language, content),
|
||||
response_model.model_json_schema(),
|
||||
strict=True,
|
||||
tools=tools if client.enable_web_grounding() else None,
|
||||
tools=[SearchWebTool] if client.enable_web_grounding() else None,
|
||||
):
|
||||
yield chunk
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from datetime import datetime
|
||||
from models.llm_message import LLMSystemMessage, LLMUserMessage
|
||||
from models.presentation_layout import SlideLayoutModel
|
||||
from models.presentation_outline_model import SlideOutlineModel
|
||||
|
|
@ -16,17 +17,26 @@ system_prompt = """
|
|||
# Notes
|
||||
- Slide body should not use words like "This slide", "This presentation".
|
||||
- Rephrase the slide body to make it flow naturally.
|
||||
- Provide prompt to generate image on "__image_prompt__" property.
|
||||
- Provide query to search icon on "__icon_query__" property.
|
||||
- Only use markdown to highlight important points.
|
||||
- Make sure to follow language guidelines.
|
||||
- Speaker note should be normal text, not markdown.
|
||||
**Strictly follow the max and min character limit for every property in the slide.**
|
||||
|
||||
# Image and Icon Output Format
|
||||
image: {
|
||||
__image_prompt__: string,
|
||||
}
|
||||
icon: {
|
||||
__icon_query__: string,
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def get_user_prompt(outline: str, language: str):
|
||||
return f"""
|
||||
## Current Date and Time
|
||||
{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
|
||||
|
||||
## Icon Query And Image Prompt Language
|
||||
English
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue