MCPcopy Create free account
hub / github.com/Azure-Samples/llama-index-python / chat_request

Function chat_request

backend/app/api/routers/chat.py:94–105  ·  view source on GitHub ↗
(
    data: ChatData,
    chat_engine: BaseChatEngine = Depends(get_chat_engine),
)

Source from the content-addressed store, hash-verified

92# non-streaming endpoint - delete if not needed
93@r.post("/request")
94async def chat_request(
95 data: ChatData,
96 chat_engine: BaseChatEngine = Depends(get_chat_engine),
97) -> Result:
98 last_message_content = data.get_last_message_content()
99 messages = data.get_history_messages()
100
101 response = await chat_engine.achat(last_message_content, messages)
102 return Result(
103 result=Message(role=MessageRole.ASSISTANT, content=response.response),
104 nodes=SourceNodes.from_source_nodes(response.source_nodes),
105 )
106
107
108@r.get("/config")

Callers

nothing calls this directly

Calls 5

ResultClass · 0.90
MessageClass · 0.90
get_history_messagesMethod · 0.80
from_source_nodesMethod · 0.80

Tested by

no test coverage detected