subashpoudel's picture
Implemented the workflow and integrated in fast api
be3a5c4
raw
history blame
1.51 kB
from langchain_core.messages import SystemMessage
from langchain_groq import ChatGroq
from pydantic import BaseModel, Field
from dotenv import load_dotenv
load_dotenv()
import os
import numpy as np
os.environ['GROQ_API_KEY']=os.getenv('GROQ_API_KEY')
llm = ChatGroq(
model="llama3-8b-8192",
temperature=0,
max_tokens=None,
timeout=None,
max_retries=2,
)
class StoryFormatter(BaseModel):
"""Always use this tool to structure your response to the user."""
story: str=Field(description="How to introduce the scene and set the tone. What is happening in the scene? Describe key visuals and actions")
narration:str=Field(description="Suggestions for narration or voiceover that complements the visuals." )
text_in_the_Video:str=Field(description="Propose important text overlays for key moments.")
transitions:str=Field(description="Smooth transitions between scenes to maintain flow.")
emotional_tone:str=Field(description="The mood and energy of the scenes (e.g., excitement, calm, tension, joy")
key_visuals:str=Field(description="Important props, locations, sound effects, or background music to enhance the video.")
class BrainstromTopicFormatter(BaseModel):
topic1:str=Field(description="First brainstorming topic of the story")
topic2:str=Field(description="Second brainstorming topic of the story")
topic3:str=Field(description="Third brainstorming topic of the story")
topic4:str=Field(description="Fourth brainstorming topic of the story")