mirror of https://gitee.com/namelin2022/ollama
10 changed files with 79 additions and 1 deletions
@ -0,0 +1,15 @@ |
|||
# LangChain Web Summarization |
|||
|
|||
This example summarizes a website |
|||
|
|||
## Setup |
|||
|
|||
``` |
|||
pip install -r requirements.txt |
|||
``` |
|||
|
|||
## Run |
|||
|
|||
``` |
|||
python main.py |
|||
``` |
|||
@ -0,0 +1,12 @@ |
|||
from langchain.llms import Ollama |
|||
from langchain.document_loaders import WebBaseLoader |
|||
from langchain.chains.summarize import load_summarize_chain |
|||
|
|||
loader = WebBaseLoader("https://ollama.ai/blog/run-llama2-uncensored-locally") |
|||
docs = loader.load() |
|||
|
|||
llm = Ollama(model="llama2") |
|||
chain = load_summarize_chain(llm, chain_type="stuff") |
|||
|
|||
result = chain.run(docs) |
|||
print(result) |
|||
@ -0,0 +1,2 @@ |
|||
langchain==0.0.259 |
|||
bs4==0.0.1 |
|||
@ -0,0 +1,15 @@ |
|||
# LangChain Web Summarization |
|||
|
|||
This example summarizes a website |
|||
|
|||
## Setup |
|||
|
|||
``` |
|||
pip install -r requirements.txt |
|||
``` |
|||
|
|||
## Run |
|||
|
|||
``` |
|||
python main.py |
|||
``` |
|||
@ -0,0 +1,12 @@ |
|||
from langchain.llms import Ollama |
|||
from langchain.document_loaders import WebBaseLoader |
|||
from langchain.chains.summarize import load_summarize_chain |
|||
|
|||
loader = WebBaseLoader("https://ollama.ai/blog/run-llama2-uncensored-locally") |
|||
docs = loader.load() |
|||
|
|||
llm = Ollama(model="llama2") |
|||
chain = load_summarize_chain(llm, chain_type="stuff") |
|||
|
|||
result = chain.run(docs) |
|||
print(result) |
|||
@ -0,0 +1,2 @@ |
|||
langchain==0.0.259 |
|||
bs4==0.0.1 |
|||
@ -0,0 +1,15 @@ |
|||
# LangChain |
|||
|
|||
This example is a basic "hello world" of using LangChain with Ollama. |
|||
|
|||
## Setup |
|||
|
|||
``` |
|||
pip install -r requirements.txt |
|||
``` |
|||
|
|||
## Run |
|||
|
|||
``` |
|||
python main.py |
|||
``` |
|||
@ -0,0 +1,4 @@ |
|||
from langchain.llms import Ollama |
|||
llm = Ollama(model="llama2") |
|||
res = llm.predict("hi!") |
|||
print (res) |
|||
@ -0,0 +1 @@ |
|||
langchain==0.0.259 |
|||
Loading…
Reference in new issue