examples(foundational): added 14d docstrings
This commit is contained in:
@@ -38,6 +38,14 @@ load_dotenv(override=True)
|
|||||||
|
|
||||||
|
|
||||||
async def fetch_user_image(params: FunctionCallParams):
|
async def fetch_user_image(params: FunctionCallParams):
|
||||||
|
"""Fetch the user image and push it to the LLM.
|
||||||
|
|
||||||
|
When called, this function pushes a UserImageRequestFrame upstream to the
|
||||||
|
transport. As a result, the transport will request the user image and push a
|
||||||
|
UserImageRawFrame downstream associated to this request. When the
|
||||||
|
UserImageRawFrame reaches the LLM assistant aggregator, the image will be
|
||||||
|
added to the context.
|
||||||
|
"""
|
||||||
user_id = params.arguments["user_id"]
|
user_id = params.arguments["user_id"]
|
||||||
question = params.arguments["question"]
|
question = params.arguments["question"]
|
||||||
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
||||||
|
|||||||
@@ -38,6 +38,14 @@ load_dotenv(override=True)
|
|||||||
|
|
||||||
|
|
||||||
async def fetch_user_image(params: FunctionCallParams):
|
async def fetch_user_image(params: FunctionCallParams):
|
||||||
|
"""Fetch the user image and push it to the LLM.
|
||||||
|
|
||||||
|
When called, this function pushes a UserImageRequestFrame upstream to the
|
||||||
|
transport. As a result, the transport will request the user image and push a
|
||||||
|
UserImageRawFrame downstream associated to this request. When the
|
||||||
|
UserImageRawFrame reaches the LLM assistant aggregator, the image will be
|
||||||
|
added to the context.
|
||||||
|
"""
|
||||||
user_id = params.arguments["user_id"]
|
user_id = params.arguments["user_id"]
|
||||||
question = params.arguments["question"]
|
question = params.arguments["question"]
|
||||||
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
||||||
|
|||||||
@@ -38,6 +38,14 @@ load_dotenv(override=True)
|
|||||||
|
|
||||||
|
|
||||||
async def fetch_user_image(params: FunctionCallParams):
|
async def fetch_user_image(params: FunctionCallParams):
|
||||||
|
"""Fetch the user image and push it to the LLM.
|
||||||
|
|
||||||
|
When called, this function pushes a UserImageRequestFrame upstream to the
|
||||||
|
transport. As a result, the transport will request the user image and push a
|
||||||
|
UserImageRawFrame downstream associated to this request. When the
|
||||||
|
UserImageRawFrame reaches the LLM assistant aggregator, the image will be
|
||||||
|
added to the context.
|
||||||
|
"""
|
||||||
user_id = params.arguments["user_id"]
|
user_id = params.arguments["user_id"]
|
||||||
question = params.arguments["question"]
|
question = params.arguments["question"]
|
||||||
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ load_dotenv(override=True)
|
|||||||
|
|
||||||
|
|
||||||
async def fetch_user_image(params: FunctionCallParams):
|
async def fetch_user_image(params: FunctionCallParams):
|
||||||
|
"""Fetch the user image.
|
||||||
|
|
||||||
|
When called, this function pushes a UserImageRequestFrame upstream to the
|
||||||
|
transport. As a result, the transport will request the user image and push a
|
||||||
|
UserImageRawFrame downstream.
|
||||||
|
"""
|
||||||
user_id = params.arguments["user_id"]
|
user_id = params.arguments["user_id"]
|
||||||
question = params.arguments["question"]
|
question = params.arguments["question"]
|
||||||
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
||||||
@@ -61,7 +67,13 @@ async def fetch_user_image(params: FunctionCallParams):
|
|||||||
|
|
||||||
|
|
||||||
class UserImageProcessor(FrameProcessor):
|
class UserImageProcessor(FrameProcessor):
|
||||||
"""Converts incoming user images into context frames."""
|
"""Converts incoming user images into vision frames.
|
||||||
|
|
||||||
|
This processor handles the UserImageRawFrame from the transport, converts it
|
||||||
|
to a VisionImageRawFrame and pushes it downstream so it can be handled by a
|
||||||
|
vision service.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
||||||
await super().process_frame(frame, direction)
|
await super().process_frame(frame, direction)
|
||||||
|
|||||||
@@ -39,6 +39,14 @@ load_dotenv(override=True)
|
|||||||
|
|
||||||
|
|
||||||
async def fetch_user_image(params: FunctionCallParams):
|
async def fetch_user_image(params: FunctionCallParams):
|
||||||
|
"""Fetch the user image and push it to the LLM.
|
||||||
|
|
||||||
|
When called, this function pushes a UserImageRequestFrame upstream to the
|
||||||
|
transport. As a result, the transport will request the user image and push a
|
||||||
|
UserImageRawFrame downstream associated to this request. When the
|
||||||
|
UserImageRawFrame reaches the LLM assistant aggregator, the image will be
|
||||||
|
added to the context.
|
||||||
|
"""
|
||||||
user_id = params.arguments["user_id"]
|
user_id = params.arguments["user_id"]
|
||||||
question = params.arguments["question"]
|
question = params.arguments["question"]
|
||||||
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
logger.debug(f"Requesting image with user_id={user_id}, question={question}")
|
||||||
|
|||||||
Reference in New Issue
Block a user