Q&A chat bot basics with LLMs: Catch-up edition
Chain-of-Thought? Retrieval Augmented Generation? Vector embedding? Hallucination? Help!
9 min readMay 30, 2023
The constant influx of tech and terms caught you off-guard. Let’s catch you up shall we?
OpenAI Chat Completion API
Send the entire chat history on every loop. Assign roles to each message. Get the generated text (API response) and use that as bot response.
Semantic Similarity
Preprocess text into tokens, then encode them into embeddings (numerical vector representation) so machines can capture their semantic properties. This enables easy comparison of tokens based on their semantic similarity.
# Source - https://www.sbert.net/docs/quickstart.html
from sentence_transformers import SentenceTransformer, util
model = SentenceTransformer('all-MiniLM-L6-v2')
sentences = ['A man is eating food.',
'A man is eating a piece of bread.',
'The girl is carrying a baby.',
'A man is…