Gemini-Agent / src /gemini_history.py
Divyanshu3321
changed directory
86831fe
raw
history blame contribute delete
706 Bytes
from google.genai.types import Part, Content, UserContent
class ConversationBuilder:
def build_with_user_content(self, user_text: str):
response = [
UserContent(parts=[Part(text=user_text)]), # will get a role='user' automatically
]
return response
def build_with_content_only(self, model_text: str):
response = [
Content(parts=[Part(text=model_text)], role='model')
]
return response
def build_combined(self, user_text: str, model_text: str):
response = [
UserContent(parts=[Part(text=user_text)]),
Content(parts=[Part(text=model_text)], role='model')
]
return response