A large language model (LLM) is an AI model trained on enormous amounts of text to generate language. It can answer questions, summarize documents, translate, and write code. A prompt is the question, instruction, or other text you give it. section 1.4
Training adjusts numerical patterns in the model; it does not give the model human understanding. To produce a response, the model predicts one piece of text after another—rather like completing “Once upon a ...” with “time.” That approach can also produce a confident but inaccurate answer, called a hallucination. Verify important results. section 1.4
You can run an LLM locally with Ollama, which downloads and serves models but is not itself the model. Local use keeps conversations on your machine rather than sending them to a cloud service. Model size and recency are tradeoffs to consider. section 1.0 section 3.6
An LLM does not remember earlier API calls. For a chat to feel continuous, the application sends relevant previous messages with each new prompt. The model can process only a limited amount of text per request—its context window—so a long conversation may need its sent history trimmed. Stored chat history is application memory, not model memory. section 11.1 section 11.9
stream = ollama.chat(
model=model,
messages=st.session_state.messages,
stream=True,
options={"temperature": temperature}
)
In this Ollama chat call, messages supplies the history stored by Streamlit; stream=True lets the response appear as it is generated. section 11.3 section 11.7

