CompleteResult packages a text-completion prompt and the LLM’s response as two string attributes: prompt and response. section 3.1.1 section 3.1
In an OllamaLLM implementation, complete() passes the model and prompt to the asynchronous generate() call, then builds a CompleteResult from the returned response and original prompt. section 3.2.1
A completion response
For the prompt “Tell me a joke,” the returned object retains that prompt alongside the generated joke. section 3.2.1
Listing 3.1 Implementing CompleteResult
# llm_agents_from_scratch/data_structures/llm.py
from pydantic import BaseModel
from typing_extensions import Self
from llm_agents_from_scratch.data_structures.tool import ToolCall
class CompleteResult(BaseModel):
"""The llm completion result data model.
Attributes:
response: The completion response provided by the LLM.
prompt: The input prompt.
"""
response: str #A
prompt: str #BThe implementation defines CompleteResult with string fields for the prompt and response. section 3.1.1
