in packages/blueprints/gen-ai-chatbot/static-assets/chatbot-genai-components/backend/python/app/routes/bot.py [0:0]
def get_private_bot(request: Request, bot_id: str):
"""Get private bot by id."""
current_user: User = request.state.current_user
bot = find_private_bot_by_id(current_user.id, bot_id)
output = BotOutput(
id=bot.id,
title=bot.title,
instruction=bot.instruction,
description=bot.description,
create_time=bot.create_time,
last_used_time=bot.last_used_time,
is_public=True if bot.public_bot_id else False,
is_pinned=bot.is_pinned,
owned=True,
embedding_params=EmbeddingParams(
chunk_size=bot.embedding_params.chunk_size,
chunk_overlap=bot.embedding_params.chunk_overlap,
enable_partition_pdf=bot.embedding_params.enable_partition_pdf,
),
agent=Agent(
tools=[
AgentTool(name=tool.name, description=tool.description)
for tool in bot.agent.tools
]
),
knowledge=Knowledge(
source_urls=bot.knowledge.source_urls,
sitemap_urls=bot.knowledge.sitemap_urls,
filenames=bot.knowledge.filenames,
),
generation_params=GenerationParams(
max_tokens=bot.generation_params.max_tokens,
top_k=bot.generation_params.top_k,
top_p=bot.generation_params.top_p,
temperature=bot.generation_params.temperature,
stop_sequences=bot.generation_params.stop_sequences,
),
search_params=SearchParams(
max_results=bot.search_params.max_results,
),
sync_status=bot.sync_status,
sync_status_reason=bot.sync_status_reason,
sync_last_exec_id=bot.sync_last_exec_id,
display_retrieved_chunks=bot.display_retrieved_chunks,
)
return output