@@ -15,7 +15,7 @@ import { Ollama } from "@langchain/community/llms/ollama";
...
@@ -15,7 +15,7 @@ import { Ollama } from "@langchain/community/llms/ollama";
constollama=newOllama({
constollama=newOllama({
baseUrl:"http://localhost:11434",
baseUrl:"http://localhost:11434",
model:"llama3",
model:"llama3.1",
});
});
constanswer=awaitollama.invoke(`why is the sky blue?`);
constanswer=awaitollama.invoke(`why is the sky blue?`);
...
@@ -23,7 +23,7 @@ const answer = await ollama.invoke(`why is the sky blue?`);
...
@@ -23,7 +23,7 @@ const answer = await ollama.invoke(`why is the sky blue?`);
console.log(answer);
console.log(answer);
```
```
That will get us the same thing as if we ran `ollama run llama3 "why is the sky blue"` in the terminal. But we want to load a document from the web to ask a question against. **Cheerio** is a great library for ingesting a webpage, and **LangChain** uses it in their **CheerioWebBaseLoader**. So let's install **Cheerio** and build that part of the app.
That will get us the same thing as if we ran `ollama run llama3.1 "why is the sky blue"` in the terminal. But we want to load a document from the web to ask a question against. **Cheerio** is a great library for ingesting a webpage, and **LangChain** uses it in their **CheerioWebBaseLoader**. So let's install **Cheerio** and build that part of the app.
It's split up, but we have to find the relevant splits and then submit those to the model. We can do this by creating embeddings and storing them in a vector database. We can use Ollama directly to instantiate an embedding model. We will use ChromaDB in this example for a vector database. `pip install chromadb`
It's split up, but we have to find the relevant splits and then submit those to the model. We can do this by creating embeddings and storing them in a vector database. We can use Ollama directly to instantiate an embedding model. We will use ChromaDB in this example for a vector database. `pip install chromadb`
We also need to pull embedding model: `ollama pull nomic-embed-text`
```python
```python
fromlangchain.embeddingsimportOllamaEmbeddings
fromlangchain.embeddingsimportOllamaEmbeddings
fromlangchain.vectorstoresimportChroma
fromlangchain.vectorstoresimportChroma
...
@@ -68,7 +68,8 @@ The next thing is to send the question and the relevant parts of the docs to the
...
@@ -68,7 +68,8 @@ The next thing is to send the question and the relevant parts of the docs to the
@@ -19,10 +19,12 @@ Logs will often be helpful in diagnosing the problem (see
...
@@ -19,10 +19,12 @@ Logs will often be helpful in diagnosing the problem (see
## System Requirements
## System Requirements
* Windows 10 or newer, Home or Pro
* Windows 10 22H2 or newer, Home or Pro
* NVIDIA 452.39 or newer Drivers if you have an NVIDIA card
* NVIDIA 452.39 or newer Drivers if you have an NVIDIA card
* AMD Radeon Driver https://www.amd.com/en/support if you have a Radeon card
* AMD Radeon Driver https://www.amd.com/en/support if you have a Radeon card
Ollama uses unicode characters for progress indication, which may render as unknown squares in some older terminal fonts in Windows 10. If you see this, try changing your terminal font settings.
## API Access
## API Access
Here's a quick example showing API access from `powershell`
Here's a quick example showing API access from `powershell`
...
@@ -39,8 +41,8 @@ server.
...
@@ -39,8 +41,8 @@ server.
Ollama on Windows stores files in a few different locations. You can view them in
Ollama on Windows stores files in a few different locations. You can view them in
the explorer window by hitting `<cmd>+R` and type in:
the explorer window by hitting `<cmd>+R` and type in:
-`explorer %LOCALAPPDATA%\Ollama` contains logs, and downloaded updates
-`explorer %LOCALAPPDATA%\Ollama` contains logs, and downloaded updates
-*app.log* contains logs from the GUI application
-*app.log* contains most resent logs from the GUI application
-*server.log* contains the server logs
-*server.log* contains the most recent server logs
-*upgrade.log* contains log output for upgrades
-*upgrade.log* contains log output for upgrades
-`explorer %LOCALAPPDATA%\Programs\Ollama` contains the binaries (The installer adds this to your user PATH)
-`explorer %LOCALAPPDATA%\Programs\Ollama` contains the binaries (The installer adds this to your user PATH)
-`explorer %HOMEPATH%\.ollama` contains models and configuration
-`explorer %HOMEPATH%\.ollama` contains models and configuration