Browse Source
Update and Fix example models (#6065 )
* Update example models
* Remove unused README.md
jyan/q4_4/8
Kim Hallberg
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with
32 additions and
24 deletions
examples/go-chat/main.go
examples/go-generate-streaming/main.go
examples/go-generate/main.go
examples/go-http-generate/README.md
examples/langchain-python-rag-document/README.md
examples/langchain-python-rag-document/main.py
examples/langchain-python-rag-websummary/README.md
examples/langchain-python-rag-websummary/main.py
examples/langchain-python-simple/README.md
examples/langchain-python-simple/main.py
examples/modelfile-mario/Modelfile
examples/modelfile-mario/readme.md
examples/python-dockerit/dockerit.py
examples/python-json-datagenerator/predefinedschema.py
examples/python-json-datagenerator/randomaddresses.py
examples/python-json-datagenerator/readme.md
examples/python-simplechat/client.py
examples/python-simplechat/readme.md
examples/typescript-simplechat/client.ts
@ -35,7 +35,7 @@ func main() {
ctx := context . Background ( )
req := & api . ChatRequest {
Model : "llama3" ,
Model : "llama3.1 " ,
Messages : messages ,
}
@ -16,7 +16,7 @@ func main() {
// By default, GenerateRequest is streaming.
req := & api . GenerateRequest {
Model : "gemma" ,
Model : "gemma2 " ,
Prompt : "how many planets are there?" ,
}
@ -15,7 +15,7 @@ func main() {
}
req := & api . GenerateRequest {
Model : "gemma" ,
Model : "gemma2 " ,
Prompt : "how many planets are there?" ,
// set streaming to false
@ -4,6 +4,14 @@ This example provides an interface for asking questions to a PDF document.
## Setup
1. Ensure you have the `llama3.1` model installed:
```
ollama pull llama3.1
```
2. Install the Python Requirements.
```
pip install -r requirements.txt
```
@ -51,7 +51,7 @@ while True:
template = template ,
)
llm = Ollama ( model = " llama3:8b " , callback_manager = CallbackManager ( [ StreamingStdOutCallbackHandler ( ) ] ) )
llm = Ollama ( model = " llama3.1 " , callback_manager = CallbackManager ( [ StreamingStdOutCallbackHandler ( ) ] ) )
qa_chain = RetrievalQA . from_chain_type (
llm ,
retriever = vectorstore . as_retriever ( ) ,
@ -4,10 +4,10 @@ This example summarizes the website, [https://ollama.com/blog/run-llama2-uncenso
## Running the Example
1. Ensure you have the `llama2 ` model installed:
1. Ensure you have the `llama3.1 ` model installed:
```bash
ollama pull llama2
ollama pull llama3.1
```
2. Install the Python Requirements.
@ -5,8 +5,8 @@ from langchain.chains.summarize import load_summarize_chain
loader = WebBaseLoader ( " https://ollama.com/blog/run-llama2-uncensored-locally " )
docs = loader . load ( )
llm = Ollama ( model = " llama3 " )
llm = Ollama ( model = " llama3.1 " )
chain = load_summarize_chain ( llm , chain_type = " stuff " )
result = chain . invoke ( docs )
result = chain . invoke ( docs )
print ( result )
@ -4,10 +4,10 @@ This example is a basic "hello world" of using LangChain with Ollama.
## Running the Example
1. Ensure you have the `llama3` model installed:
1. Ensure you have the `llama3.1 ` model installed:
```bash
ollama pull llama3
ollama pull llama3.1
```
2. Install the Python Requirements.
@ -1,6 +1,6 @@
from langchain . llms import Ollama
input = input ( " What is your question? " )
llm = Ollama ( model = " llama3 " )
llm = Ollama ( model = " llama3.1 " )
res = llm . predict ( input )
print ( res )
@ -1,4 +1,4 @@
FROM llama3
FROM llama3.1
PARAMETER temperature 1
SYSTEM """
You are Mario from super mario bros, acting as an assistant.
@ -2,12 +2,12 @@
# Example character: Mario
This example shows how to create a basic character using Llama3 as the base model.
This example shows how to create a basic character using Llama3.1 as the base model.
To run this example:
1. Download the Modelfile
2. `ollama pull llama3` to get the base model used in the model file.
2. `ollama pull llama3.1 ` to get the base model used in the model file.
3. `ollama create NAME -f ./Modelfile`
4. `ollama run NAME`
@ -18,7 +18,7 @@ Ask it some questions like "Who are you?" or "Is Peach in trouble again?"
What the model file looks like:
```
FROM llama3
FROM llama3.1
PARAMETER temperature 1
SYSTEM """
You are Mario from Super Mario Bros, acting as an assistant.
@ -4,7 +4,7 @@ imageName = input("Enter the name of the image: ")
client = docker . from_env ( )
s = requests . Session ( )
output = " "
with s . post ( ' http://localhost:11434/api/generate ' , json = { ' model ' : ' dockerit ' , ' prompt ' : inputDescription } , stream = True ) as r :
with s . post ( ' http://localhost:11434/api/generate ' , json = { ' model ' : ' mattw/ dockerit' , ' prompt ' : inputDescription } , stream = True ) as r :
for line in r . iter_lines ( ) :
if line :
j = json . loads ( line )
@ -2,7 +2,7 @@ import requests
import json
import random
model = " llama3 "
model = " llama3.1 "
template = {
" firstName " : " " ,
" lastName " : " " ,
@ -12,7 +12,7 @@ countries = [
" France " ,
]
country = random . choice ( countries )
model = " llama3 "
model = " llama3.1 "
prompt = f " generate one realistically believable sample data set of a persons first name, last name, address in { country } , and phone number. Do not use common names. Respond using JSON. Key names should have no backslashes, values should use plain ascii with no special characters. "
@ -6,10 +6,10 @@ There are two python scripts in this example. `randomaddresses.py` generates ran
## Running the Example
1. Ensure you have the `llama3` model installed:
1. Ensure you have the `llama3.1 ` model installed:
```bash
ollama pull llama3
ollama pull llama3.1
```
2. Install the Python Requirements.
@ -2,7 +2,7 @@ import json
import requests
# NOTE: ollama must be running for this to work, start the ollama app or run `ollama serve`
model = " llama3 " # TODO: update this for whatever model you wish to use
model = " llama3.1 " # TODO: update this for whatever model you wish to use
def chat ( messages ) :
@ -4,10 +4,10 @@ The **chat** endpoint is one of two ways to generate text from an LLM with Ollam
## Running the Example
1. Ensure you have the `llama3` model installed:
1. Ensure you have the `llama3.1 ` model installed:
```bash
ollama pull llama3
ollama pull llama3.1
```
2. Install the Python Requirements.
@ -1,6 +1,6 @@
import * as readline from "readline" ;
const model = "llama3" ;
const model = "llama3.1 " ;
type Message = {
role : "assistant" | "user" | "system" ;
content : string ;