Тёмный

Ollama Embedding: How to Feed Data to AI for Better Response? 

Mervin Praison
Подписаться 33 тыс.
Просмотров 35 тыс.
50% 1

🌟 Welcome to our deep dive into Ollama Embedding for AI applications! In this comprehensive tutorial, we're unlocking the power of Ollama Embedding to enhance your app's performance significantly. 🌟 Feed Data to AI for better response.
🔍 What We Cover:
Introduction to Ollama Embedding and its advantages.
Step-by-step guide on ingesting data from URLs, converting them into embeddings, and storing in Vector Database using ChromaDB.
Integration with Nomic Embed Text for superior embedding performance.
Utilising RAG for data retrieval.
Building a user-friendly interface with Gradio.
If you like this video:
Tweet something positive or what you like about these tutorials on / @mervinpraison
"@MervinPraison ......................."
🛠️ Setup Steps:
Installation of necessary packages (Lang Chain, Chroma Embeddings, etc.)
Detailed walkthrough for setting up your application file.
Splitting data, converting to embeddings, and database storage.
Creating and integrating the user interface with Gradio.
🔗 Resources & Links:
Ollama Tutorials: • Ollama Tutorial
Patreon: / mervinpraison
Ko-fi: ko-fi.com/mervinpraison
Discord: / discord
Twitter / X : / mervinpraison
Code: mer.vin/2024/02/ollama-embedd...
👀 Why Watch:
Learn to create AI applications with enhanced performance.
Understand the benefits of using Nomic Embed Text over other models.
Gain insights into creating efficient user interfaces for your AI apps.
📌 Don't forget to subscribe and hit the bell icon to stay updated with our latest videos on Artificial Intelligence. Like this video to help spread knowledge to more enthusiasts like you!
Timestamps:
0:00 - Introduction to Ollama Embedding
0:39 - Benefits of Nomic Embed Text
1:00 - User Interface Preview
1:04 - Subscription Reminder
1:21 - Setting Up Your Application
3:00 - Understanding the Rag Process
4:01 - Running the Code
5:00 - Adding User Interface with Gradio
#OllamaEmbedding #Local #Nomic #OllamaEmbeddings #OllamaNomic #OllamaNomicEmbedding #NomicEmbedding #NomicEmbeddings #NomicOllama #EmbeddingOllama #Embed #Embedding #LocalRAG #OllamaLocalRAG
#ollama #runollamalocally #howtoinstallollama #ollamaonmacos #installingollama #localllm #mistral7b #installllmlocally #opensource #llms #opensourceLLM #custommodel #localagents #opensourceAI #llmlocal #localAI #llmslocally #opensource #Olama #Mistral #OllamaMistral #Chroma #ChromaDB #LangChain

Хобби

Опубликовано:

 

3 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 111   
@santiagolarrain
@santiagolarrain 4 месяца назад
This channel is gold. Short, to the point, Dev focus, latest IA... Thank you so much for taking the time to upload almost daily.
@MervinPraison
@MervinPraison 4 месяца назад
Thank you 😊
@technobabble77
@technobabble77 3 месяца назад
Thanks so much! I was just stuck in a project and was trying to work my way through RAG, and now I've got the solution!
@stiofanmacthomais
@stiofanmacthomais 3 месяца назад
Superb tutorial! Concise, clear and produces results - perfect!
@kinnaa1234
@kinnaa1234 4 месяца назад
you are full metal no fluff. the best.
@mohamedkeddache4202
@mohamedkeddache4202 3 месяца назад
your channel is a hidden gem 💎
@gnashermedia
@gnashermedia 4 месяца назад
What a fantastic video and tutorial. Many many thanks. I'm currently trying to transit my job as software dev to AI/ML stuff and this tutorial is very valuable to me to get a grip to all the new stuff. I'm more a do it and try and error type learner. Thanks a lot.
@Van-Helssen
@Van-Helssen Месяц назад
amazing Mervin, you got another subscriber here. Nice content ❤
@yongjintang1511
@yongjintang1511 3 месяца назад
❤ very very very simple, clear, and beautiful, thanks bro
@user-uk9ls
@user-uk9ls 3 месяца назад
Super video. It works like a charm!
@amirulbrinto
@amirulbrinto 4 месяца назад
Really helpful! Thanks for the video.
@syciciel1180
@syciciel1180 Месяц назад
It is crazy simple and efficient, thx man!
@mirosawh.1600
@mirosawh.1600 3 месяца назад
Oh buddy, this is a super cool tutorial. As simple as a stick :) Thanks a lot!
@tperham01
@tperham01 25 дней назад
Fantastic tutorial mate! Most examples I've seen use the OpenAI embedding models which unit normalise the vectors, and so when you switch to ollama embeddings the distance numbers are very large (and so you can't use the same similarity metrics). This workflow has given me a way forward ☺️
@RichardLucas
@RichardLucas 3 месяца назад
Non sequitor but you really have a soothing voice and a pleasant demeanor _in addition_ to being clearly on the bow wave of this thing. Thanks for all of it.
@melikey4398
@melikey4398 3 месяца назад
nicely done mervin thank you
@hakimleon-ls4ll
@hakimleon-ls4ll 4 месяца назад
Awsome. Thanks for the video
@jonzh4720
@jonzh4720 4 месяца назад
Thanks, i always thought that embedding model and chat model always have to be same. Especially for the dimension must match, but your example show difference and works. This is new to me.
@MervinPraison
@MervinPraison 4 месяца назад
Can be different
@Builder-pw4qn
@Builder-pw4qn 3 месяца назад
Your content is 🔥. I would love to see you combine Ollama utilizing Groq, Ollama embeddings, RAG with document uploads and url, and a Gradio UI.
@mohammadyahya78
@mohammadyahya78 10 дней назад
Amazing.
@cihangirkoroglu
@cihangirkoroglu 4 месяца назад
Thank you😊
@MervinPraison
@MervinPraison 4 месяца назад
🙏
@fnmby
@fnmby 3 месяца назад
Good video!
@technobabble77
@technobabble77 3 месяца назад
FYI: In a fresh virtual environment, I needed to also install bs4, chromadb, and tiktoken as well as pulling the models.
@user-lv9hk2lz9z
@user-lv9hk2lz9z 4 месяца назад
Good news. Would like to see an easy way to set up conversational memory with ollama
@MervinPraison
@MervinPraison 4 месяца назад
Great suggestion! Will look in to that
@cloudshoring
@cloudshoring 2 месяца назад
Great!
@BobWeberJr
@BobWeberJr 4 месяца назад
Great job!
@MervinPraison
@MervinPraison 4 месяца назад
Thank you
@sam.sleepwell
@sam.sleepwell 4 месяца назад
Great content! Super useful embedding. Seems we need to use nomic API from now on for using the embedding?
@hunkims
@hunkims 4 месяца назад
This is an amazing video. Do you know how to evaluate the RAG results?
@Canna_Science_and_Technology
@Canna_Science_and_Technology 2 месяца назад
A reference to Ollama locally would be nice.
@leversofpower
@leversofpower 4 месяца назад
Thanks!
@MervinPraison
@MervinPraison 4 месяца назад
🙏
@MattJonesYT
@MattJonesYT 4 месяца назад
With regular RAG you can examine the snippet you get to see if they are actually relevant and then correct if not. That is "corrective rag". How do you do that when using embeddings? Does it become a black box and is no longer steerable?
@amardewri
@amardewri 4 месяца назад
This is amazing! I recently discovered your channel and have been continuously watching your videos. Wanted to ask if it’s possible to make an app using embeddings, vector db, LangChain and local LLM where Ai asks the questions. A scenario something like AI asking patient a series of questions for symptoms and based on the response suggest possible diagnosis. Further AI questions change based on user response. Like questions can branch out to specific area and drill down further. If user has problems with listening then vector db related to ENT can be plugged in and question related to ENT is asked. Once all information is collected it can be embedded and stored into vector db with patient name and later doctor can ask the AI for patient details. Ai can plugin the patient vector db and respond. Not looking for a complete solution but the possibility of making the App ask questions and store the responses. If it’s possible then a short video would be awesome!! I understand all this can be done with predefined template or form to collect information. Just wondering how to make GenAi ask the right questions. I hope I’m making sense 😂.
@MervinPraison
@MervinPraison 4 месяца назад
Thanks for subscribing and watching 🙏 This is totally possible and might require some condition based approach.
@user-gv7nu1rh9x
@user-gv7nu1rh9x 4 месяца назад
is there any way that i can do function calling with a tiny llm, it is even ok if i need to fine-tune it
@MikewasG
@MikewasG 4 месяца назад
Thank you very much for your efforts. Your videos have been incredibly helpful to me! I have a question: In my experience, RAG's performance in extracting information from tables or images in PDFs is quite poor. Is there any way to improve this?
@SenaitMatthew
@SenaitMatthew 2 месяца назад
Thank you so much for sharing! I got error show attribute error : module langchain_community.embeddings has no attribute ollama” what it can be?
@everybodyguitar5271
@everybodyguitar5271 День назад
Great video, thanks. But I got the following response for after RAG: Number of requested results 4 is greater than number of elements in index 3, updating n_results = 3 The provided context does not specify what Ollama is, only that there is no healthy upstream in various documents from the Ollama website or blog. Any idea?
@stanTrX
@stanTrX 3 месяца назад
Thanks. Can we directly upload document instead of providin the urls?
@PoGGiE06
@PoGGiE06 3 месяца назад
Great video. Would you use a simpler model e.g. tinydolphin for embeddings, given the greater speed? or would embeddings quality suffer too much? It seems to take a very long time to do embeddings on large files, and produce very large output files: e.g. a 21 mb sec edgar 10k took about 90 minutes to index and mushroomed into about 1.1gb of index files (!).
@BlueBeatleBurt
@BlueBeatleBurt Месяц назад
Can you switch out the mistral model with llama3? Great video btw! Short and sweat!
@ConsultingjoeOnline
@ConsultingjoeOnline 3 месяца назад
Hi, great video, thanks. But there must still be a better way. When the data is over saturated on a topic it does not select the best chunk. Also how can you store the vectorstores for faster loading? Thanks
@mdbikasuzzaman7685
@mdbikasuzzaman7685 4 месяца назад
without fine tune, is possible to get the summary and question answer from this single mistral model?
@skaramicke
@skaramicke 3 месяца назад
Do you gain a lot of efficiency by using a different models for embedding and inference? It takes time to change models in Ollama.
@jrfcs18
@jrfcs18 4 месяца назад
How do you modify this code to load a local text document instead of URL?
@stiofanmacthomais
@stiofanmacthomais 3 месяца назад
print ("Loading data...") loader = TextLoader ("./data/my_data.txt") documents = loader.load()
@FetaleKetones
@FetaleKetones 2 месяца назад
@@stiofanmacthomaisnot sure if this works but telling you thanks :)
@saintsscholars8231
@saintsscholars8231 4 месяца назад
Would be great if you could modify the code to create the embeddings from a local folder on a desktop.
@MervinPraison
@MervinPraison 4 месяца назад
Yes it is possible. Try something like this python.langchain.com/docs/modules/data_connection/document_loaders/file_directory
@worldsbestg.b8656
@worldsbestg.b8656 4 месяца назад
can you create a video to use crewai with memgpt
@biskero
@biskero 4 месяца назад
can you do another example on how you select the best model for a specific query?
@MervinPraison
@MervinPraison 4 месяца назад
Sure I will look into that
@user-wm8hy8ce2o
@user-wm8hy8ce2o 3 месяца назад
please tell me how to stream the response in the output section , i need that in my project please help
@vertigoz
@vertigoz 2 месяца назад
The embeddings aren't dependent of the question, are them? It can do it just to retrieve information out of the site
@ayumi5621
@ayumi5621 4 месяца назад
So im a newbie, but how do I get data from a persistent chroma db?
@AdrianoMartins93
@AdrianoMartins93 3 месяца назад
Is there an equivalent to run on Spring Boot?
@ChignaData
@ChignaData 29 дней назад
Is there a way to use the GPU using this code? how would i do it ?
@Crank797
@Crank797 2 месяца назад
This video is 2 months old. I feel like I'm missing out!! AHH!
@tk-tt5bw
@tk-tt5bw 3 месяца назад
Is it actually possible to deploy this on azure or aws
@mykolagolovko
@mykolagolovko 3 месяца назад
Great video, but when I tried it I got an index error that I fixed by adding another link to the list of sites. However, now I get Using embedded DuckDB without persistence: data will be transient No embedding_function provided, using default embedding function: SentenceTransformerEmbeddingFunction". As a result both answers provided are roughly the same without the context. Anyone else faced this issue?
@mykolagolovko
@mykolagolovko 3 месяца назад
This happened on Windows. I modified the retriever line as such "retriever = vectorstore.as_retriever(search_kwargs={"k":1})". fixed both issues
@FileTransferProtocol
@FileTransferProtocol 4 месяца назад
Sorry for the very basic question, but what IDE are you using? Is that VS Code?
@RiddleMaster-wi9yw
@RiddleMaster-wi9yw 4 месяца назад
I think so
@mehditaslimifar2521
@mehditaslimifar2521 4 месяца назад
Thanks for the great content. I tried to follow and got into this error, raise ValueError( ValueError: Error raised by inference API HTTP code: 404, {"error":"model 'nomic-embed-text' not found, try pulling it first"}
@user-un5mi8nv7m
@user-un5mi8nv7m 2 месяца назад
you need run "ollama pull nomic-embed-text"
@bobinou
@bobinou 3 месяца назад
How can i store the data long term, so that i dont need to convert the website to a embedding every time?
@mohamedabdelrehem7698
@mohamedabdelrehem7698 4 месяца назад
So this can work offline? And if yes can i make an api running on server and use it for a custom mobile app
@MervinPraison
@MervinPraison 4 месяца назад
Yes . Yes you can
@user-hu2hv2uf8f
@user-hu2hv2uf8f 3 месяца назад
How do I get this db?
@manulectric
@manulectric 4 месяца назад
This code didn't work for me as is, can you include a requirements.txt and also how to install nomic?
@MervinPraison
@MervinPraison 4 месяца назад
First, Try creating virtual env with conda and try it. Second, Try upgrading those packages pip install -U langchain langchain-community langchain-core Nomic: ollama pull nomic-embed-text
@THE-AI_INSIDER
@THE-AI_INSIDER 4 месяца назад
I am getting a message along with the output - "Number of requested results 4 is greater than number of elements in index 3, updating n_results = 3" Can you please let me know where to set the below value in your code: search_kwargs={"k": 1}
@jrfcs18
@jrfcs18 4 месяца назад
I had that same error but I put k argument here in this line and it seemed to work: retriever = vectorstore.as_retriever(search_kwargs={"k":1})
@THE-AI_INSIDER
@THE-AI_INSIDER 4 месяца назад
yeah it works like this@@jrfcs18
@SonGoku-pc7jl
@SonGoku-pc7jl 4 месяца назад
thanks! why in code PyPDFLoader and PydanticOutputParser I get underlines and those lines give me an error when executing the code? thanks, great video like all your videos ;) maybe pwd not work in windows? but import platform if platform.system() != 'Windows': import pwd not work. pwd also have underlines from langchain_community.document_loaders import WebBaseLoader, PyPDFLoader File "C:\Program Files\Python310\lib\site-packages\langchain_community\document_loaders\__init__.py", line 163, in from langchain_community.document_loaders.pebblo import PebbloSafeLoader File "C:\Program Files\Python310\lib\site-packages\langchain_community\document_loaders\pebblo.py", line 5, in import pwd ModuleNotFoundError: No module named 'pwd' maybe is code for linux and not for windows? :(
@MervinPraison
@MervinPraison 4 месяца назад
First, Try creating virtual env with conda and try it. Second, Try upgrading those packages pip install -U langchain langchain-community langchain-core
@jacobrogers8933
@jacobrogers8933 4 месяца назад
What is the benefit following this tutorial vs. installing and running AnythingLLM in conjunction with Ollama? This is a genuine question as I am a complete novice with ZERO knowledge in any coding language.
@riteshramkumar7074
@riteshramkumar7074 4 месяца назад
Was anyone able to run this code in windows?
@HyperUpscale
@HyperUpscale 4 месяца назад
Yes - without any issues - the code is perfect 👌 You just need to add for the installation: 1. add gradio (if you want to use the UI): pip install gradio 2. Install nomic: ollama pull nomic-embed-text
@HyperUpscale
@HyperUpscale 4 месяца назад
​@@riteshramkumar7074 Yes, Of course!!! Because "nomic-embed-text" is not a model, but embeddings. You don't run it, you have to only download it with "ollama PULL nomic-embed-text". It is like a plugin that would be called later. So the code will call it and use it: embedding=embeddings.ollama.OllamaEmbeddings(model='nomic-embed-text'), So you just need to PULL it :)
@joxxen
@joxxen 3 месяца назад
I'm getting pwd issue, asking ChatGPT it tells me this is not available in windows, but updating the pip install -U langchain langchain-community langchain-core fixed that issue
@Ahwu_AIClass
@Ahwu_AIClass 3 месяца назад
🎯 Key Takeaways for quick navigation: 00:00 *🚀 介绍主题:基于 Ollama 嵌入创建问答应用* - 使用 Ollama 嵌入提高问答应用性能 - 从 URL 获取数据,将其转换为嵌入并存储在向量数据库中 - 使用大型语言模型和相关数据生成答复 01:13 *🧰 设置步骤* - 安装必要的 Python 库 - 定义大型语言模型 - 使用 web 加载器从 URL 提取数据 01:54 *✂️ 切分文本数据* - 使用 CharacterTextSplitter 将数据切分成块 - 指定块大小和重叠区域 02:21 *🗄️ 嵌入和向量存储* - 初始化 ChromaDB 向量数据库 - 使用 Ollama 嵌入模型将文档转换为嵌入 - 将嵌入存储在 ChromaDB 中 02:49 *🧠 检索问答链* - 定义提示模板 - 创建问答链,结合上下文和问题 - 演示在不使用上下文和使用上下文的情况下的表现差异 04:27 *💻 本地运行大模型* - 展示运行结果,Ollama 是本地运行大语言模型的平台 - 适用于 macOS、Linux 和 Windows系统 04:40 *🌐 添加用户界面* - 使用 Gradio 库构建 Web UI - 演示输入 URL 和问题并获取答复的过程 Made with HARPA AI
@nverma5326
@nverma5326 2 месяца назад
Dude are you indian cus u have that tamil programming thing.
@PerFeldvoss
@PerFeldvoss 4 месяца назад
Great this is working out of the box. The text data stored in the vector database seems to be stripped of the linked pages, so perhaps what I need is a better overview the document loaders. Also I added a few lines to check if the urls are actually change... if only that a the vector store is cleared and the created. (how would you do that?) I would like to be able to save and select the vector store, perhaps even add some meta data to the vector store Finally the real new thing, how does this work: embedding=embeddings.ollama.OllamaEmbeddings(model='nomic-embed-text') ?
@thedavc
@thedavc 2 месяца назад
I'm running into the following errors: raise AttributeError(f"module {__name__} has no attribute {name}") AttributeError: module langchain_community.embeddings has no attribute ollama
@thedavc
@thedavc 2 месяца назад
I believe adding the following lines resolves it for me. from langchain_community.embeddings import OllamaEmbeddings
@cultured9162
@cultured9162 2 месяца назад
Hey! I am getting the following error: AttributeError: module langchain_community.embeddings has no attribute ollama Amazing video nevertheless
@RennValo-NOAAAffiliate
@RennValo-NOAAAffiliate 2 месяца назад
I'm seeing the same error "AttributeError: module langchain_community.embeddings has no attribute ollama"
@joechin1968
@joechin1968 2 месяца назад
Around line 27, change "embedding=embeddings.ollama.OllamaEmbeddings(..." to "embedding=embeddings.OllamaEmbeddings(..." Seems like the class name got changed
@joechin1968
@joechin1968 2 месяца назад
@MervinPraison great tutorials btw. Thanks for creating them
@RennValo-NOAAAffiliate
@RennValo-NOAAAffiliate 2 месяца назад
@@joechin1968 Thank you. Yes, I believe you're right. This type of work is a moving target 🙂
@vincentnestler1805
@vincentnestler1805 4 месяца назад
Thanks!
@MervinPraison
@MervinPraison 4 месяца назад
Thank you :)
Далее
Python RAG Tutorial (with Local LLMs): AI For Your PDFs
21:33
GraphRAG: The Most Incredible RAG Strategy Revealed
10:38
Open Source RAG running LLMs locally with Ollama
10:00
Get Embeddings From Llama3
3:52
Просмотров 4,9 тыс.
host ALL your AI locally
24:20
Просмотров 807 тыс.
Ollama meets LangChain
6:30
Просмотров 46 тыс.
RAG from the Ground Up with Python and Ollama
15:32
Просмотров 25 тыс.