is so large that it achieves general-purpose language understanding and generation. Review: This movie sucks. Sentiment: negative Review: I love this movie: Sentiment: Input LLM positive Output
text-embedding-3 OpenAI.com Azure OpenAI, GitHub Models Microsoft Phi-3, Phi-3-mini, Phi-3.5 Azure AI Models Catalog, GitHub Models Cohere Command R, R+, Embed Mistral Nemo, Small Large Azure AI Models Catalog, GitHub Models, Google Vertex AI Meta LlaMA 3.1-8B, 70B, 405B Google Gemini Google Vertex AI Anthropic Claude 3 AWS Bedrock, Google Vertex AI https://azure.microsoft.com/products/ai-services/openai-service https://azure.microsoft.com/products/ai-model-catalog https://github.com/marketplace/models
AUTH_TOKEN Content-Type: application/json { "messages": [{"role":"system","content":"You are an AI assistant that loves emojis."}, {"role":"user","content":"What is the capital of France?"}], "max_tokens": 800, "temperature": 0.7, "frequency_penalty": 0, "presence_penalty": 0, "top_p": 0.95, "stop": null } https://github.com/pamelafox/python-openai-demos
msrp | acceleration | --- | --- | --- | --- | --- | --- Prius (1st Gen) | 1997 | 24509.74 | 7.46 | Prius (2nd Gen) | 2000 | 26832.25 | 7.97 | Prius (3rd Gen) | 2009 | 24641.18 | 9.6 | Prius V | 2011 | 27272.28 | 9.51 | Prius C | 2012 | 19006.62 | 9.35 | Prius PHV | 2012 | 32095.61 | 8.82 | Prius C | 2013 | 19080.0 | 8.7 | Prius | 2013 | 24200.0 | 10.2 | Prius Plug-in | 2013 | 32000.0 | 9.17 | Large Language Model The Prius V has an acceleration of 9.51 seconds from 0 to 60 mph. User Question How fast is the Prius V?
Bearer {{$dotenv TOKEN}} Content-Type: application/json {"messages": [ {"role":"system", "content":"You are a helpful assistant that answers questions about cars based off a hybrid car data set. You must use the data set to answer the questions, you should not provide any info that is not in the provided sources. Sources are provided as a Markdown table." }, {"role":"user", "content": "How fast is the Prius V?\n\nSources: vehicle | year | msrp | acceleration | mpg | class\n --- | --- | --- | --- | --- | --- |\nPrius (1st Gen) | 1997 | 24509.74 | 7.46 | 41.26 | Compact|\nPrius (2nd Gen) | 2000 | 26832.25 | 7.97... }]} https://github.com/pamelafox/python-openai-demos/blob/main/retrieval_augmented_generation.py
the TrekExtreme Hiking Shoes 1 or the Trailblaze Steel-Blue Hiking Shoes 2 User Question What's the best shoe for hiking? Search [101]: Name: TrekExtreme Hiking Shoes Price: 135.99 Brand: Raptor Elite Type: Footwear Description: The Trek Extreme hiking shoes by Raptor Elite are built to ensure any trail. …
hiking shoes, consider the TrekExtreme Hiking Shoes 1 or the Trailblaze Steel-Blue Hiking Shoes 2 User Question what's a good shoe for a mountain trale? Search [101]: Name: TrekExtreme Hiking Shoes Price: 135.99 Brand: Raptor Elite Type: Footwear Description: The Trek Extreme hiking shoes by Raptor Elite are built to ensure any trail. … mountain trail shoe Large Language Model
climbing gear cheaper than $30? Large Language Model with function calling search_database( "climbing_gear", {"column": "price", "operator" : "<", "value" : "30" } )
offer 2 climbing bags for your budget: SummitStone Chalk Bag 1 Guardian Blue Chalk Bag 2 User Question Do you sell climbing gear cheaper than $30? “Do you sell…” [12]: Name: SummitStone Chalk Bag Price:29.99 Brand:Grolltex Type:Climbing Description: The SummitStone Chalk Bag in forest green is a must- have for climbers seeking adventure. … Search price < 30 LLM with function calling “Do you sell…” “climbing gear”
under PerksPlus include: · Skiing and snowboarding lessons · Scuba diving lessons · Surfing lessons · Horseback riding lessons These lessons provide employees with the opportunity to try new things, challenge themselves, and improve their physical skills.…. Large Language Model Yes, your company perks cover underwater activities such as scuba diving lessons 1 User Question Do my company perks cover underwater activities?
html, images You need an ingestion process for extracting, splitting, vectorizing, and storing document chunks. You need a way to search the vectorized chunks. Database rows (Structured data) You need a way to vectorize target columns with an embedding model. You need a way to search the vectorized rows. + LLM for answering the question based off data
a format that can be indexed and processed by LLM Azure: Document Intelligence Local: PyMuPDF, BeautifulSoup Retriever: A knowledge base that can efficiently retrieve sources that match a user query (Ideally supports both vector and full-text search) Azure: Azure AI Search, Azure CosmosDB, Local: PostgreSQL, Qdrant, Pinecone LLM: A model that can answer questions based on the query based on the provided sources, and can include citations OpenAI: GPT 3.5, GPT 4, GPT-4o Azure AI Studio: Meta Llama3, Mistral, Cohere R+ Anthropic: Claude 3.5 Google: Gemini 1.5 Orchestrator (optional): A way to organize calls to the retriever and LLM Community: Langchain, Llamaindex Microsoft: Semantic Kernel, Autogen Features Chat history, Feedback buttons, Text-to-speech, User login, File upload, Access control, etc.
(relative to the knowledge base) Is it formatted in the desired manner? Yes, underwater activities are included as part of the PerksPlus program. Some of the underwater activities covered under PerksPlus include scuba diving lessons [PerksPlus.pdf#page=3]. Yes, according to the information provided in the PerksPlus.pdf document, underwater activities such as scuba diving are covered under the program. Yes, the perks provided by the PerksPlus Health and Wellness Reimbursement Program cover a wide range of fitness activities, including underwater activities such as scuba diving. The program aims to support employees' physical health and overall well-being, so it includes various lessons and experiences that promote health and wellness. Scuba diving lessons are specifically mentioned as one of the activities covered under PerksPlus. Therefore, if an employee wishes to pursue scuba diving as a fitness-related activity, they can expense it through the PerksPlus program. Do the perks cover underwater activities? What's a high quality answer?
# of results returned • Search query cleaning step • Data preparation Knowledge Search Large Language Model Question • Model • Temperature • Max tokens • Message history • System prompt Factors that affect answer quality
question. It can be generated synthetically, but manual curation is necessary! Database Large Language Model results Q/A pairs Human review Step 1: Generate ground truth data
prompt metrics question gpt_coherence gpt_groundedness gpt_relevance length citation_match Compute LLM metrics and custom metrics for every question in ground truth. latency This can be run locally or in a CI workflow. Step 2: Evaluate app against ground truth
convincingly wrong. What works better for 3 Qs doesn't always work better for 200. Don't trust absolute metrics, trust relative metrics. Vector search can be noisy! Use wisely. Your model choice makes a huge difference. Remove the fluff from prompts; it doesn't matter. Lessons learnt from evaluations
small models https://github.com/microsoft/Phi-3CookBook Building GPT models from scratch https://www.youtube.com/@AndrejKarpathy https://sebastianraschka.com/books/ Working with Pytorch https://pytorchstepbystep.com/ https://learn.microsoft.com/training/paths/pytorch-fundamentals/ Ping me if you're looking or other resources or code samples! @pamelafox