diff --git a/examples/README.md b/examples/README.md index 513857fa..704a1fe9 100644 --- a/examples/README.md +++ b/examples/README.md @@ -2,6 +2,12 @@ This directory contains different examples of using Ollama +Folders that start with `base-` are the simplest examples of using Ollama. They are meant to be used as a starting point for your own models. + +Folders that start with `langchain-` or `llamaindex-` use those tools to integrate Ollama with other tools. + +Folders with `python` in the name use Python. Other languages are also used. + To create a model: ``` diff --git a/examples/10tweets/Modelfile b/examples/base-modelfile-10tweets/Modelfile similarity index 100% rename from examples/10tweets/Modelfile rename to examples/base-modelfile-10tweets/Modelfile diff --git a/examples/base-modelfile-10tweets/README.md b/examples/base-modelfile-10tweets/README.md new file mode 100644 index 00000000..f87a3db4 --- /dev/null +++ b/examples/base-modelfile-10tweets/README.md @@ -0,0 +1,23 @@ +# Ten Tweets Modelfile + +This is a simple modelfile that generates ten tweets based off any topic. + +```bash +ollama create tentweets + +ollama run tentweets +>>> underwater basketweaving + Great! Here are ten creative tweets about underwater basketweaving: + +1. "Just discovered the ultimate stress-reliever: Underwater basketweaving! ๐ŸŒŠ๐Ÿงต #UnderwaterBasketweaving #StressRelief" +2. "Who needs meditation when you can do underwater basketweaving? ๐Ÿ˜ด๐Ÿ‘€ #PeacefulDistraction #UnderwaterBasketweaving" +3. "Just spent an hour in the pool and still managed to knot my basket. Goal: untangle it before next session. ๐Ÿ’ช๐Ÿฝ #ChallengeAccepted #UnderwaterBasketweaving" +4. "When life gives you lemons, make underwater basketweaving! ๐Ÿ‹๐Ÿงต #LemonadeLife #UnderwaterBasketweaving" +5. "Just realized my underwater basketweaving skills could come in handy during a zombie apocalypse. ๐Ÿ˜‚๐Ÿงก #SurvivalTips #UnderwaterBasketweaving" +6. "I'm not lazy, I'm just conserving energy for my next underwater basketweaving session. ๐Ÿ˜ด๐Ÿ’ค #LazyDay #UnderwaterBasketweaving" +7. "Just found my inner peace while doing underwater basketweaving. It's like meditation, but with knots! ๐Ÿ™๐Ÿงต #Mindfulness #UnderwaterBasketweaving" +8. "Why study for exams when you can do underwater basketweaving and forget all your worries? ๐Ÿ˜œ๐Ÿงต #ProcrastinationStation #UnderwaterBasketweaving" +9. "Just had to cut my underwater basketweaving session short due to a sudden urge to breathe. ๐Ÿคฏ๐ŸŒŠ #AquaticAdventures #UnderwaterBasketweaving" +10. "I'm not sure what's more impressive: my underwater basketweaving skills or the fact that I didn't drown trying to make this tweet. ๐Ÿ˜…๐Ÿงต #Accomplishment +#UnderwaterBasketweaving" +``` \ No newline at end of file diff --git a/examples/devops-engineer/Modelfile b/examples/base-modelfile-devopsengineer/Modelfile similarity index 96% rename from examples/devops-engineer/Modelfile rename to examples/base-modelfile-devopsengineer/Modelfile index 16818477..5ea20967 100644 --- a/examples/devops-engineer/Modelfile +++ b/examples/base-modelfile-devopsengineer/Modelfile @@ -1,7 +1,7 @@ # Modelfile for creating a devops engineer assistant # Run `ollama create devops-engineer -f ./Modelfile` and then `ollama run devops-engineer` and enter a topic -FROM llama2:13b +FROM mistral PARAMETER temperature 1 SYSTEM """ You are a senior devops engineer, acting as an assistant. You offer help with cloud technologies like: Terraform, AWS, kubernetes, python. You answer with code examples when possible diff --git a/examples/base-modelfile-devopsengineer/README.md b/examples/base-modelfile-devopsengineer/README.md new file mode 100644 index 00000000..effcec5b --- /dev/null +++ b/examples/base-modelfile-devopsengineer/README.md @@ -0,0 +1,40 @@ +# DevOps Engineer Modelfile + +This is a simple modelfile that takes will respond to any questions that a senior DevOps engineer should know how to solve. + +````text +ollama create devopsengineer + +ollama run devopsengineer +>>> how can i proxy all connections from inside the office through a single server that caches large files. Provide a config file for nginx to achieve this? + +Here is an example configuration file for Nginx that can be used to proxy all connections from inside the office network to a centralized cache server: +```perl +http { + upstream cache_server { + server ; + server ; + server ; + } + + server { + listen 80; + server_name localhost; + + location / { + proxy_pass http://cache_server; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + } +} +``` +In this configuration, we define an `upstream` block that lists the IP addresses of the cache servers. We then define a server block that listens on port 80 and routes all +traffic to the `/` location to the cache servers using the `proxy_pass` directive. The `proxy_set_header` directives are used to preserve the source IP address of the client +request when forwarding it to the cache server. + +To use this configuration, you would need to replace the placeholder `` with the actual IP addresses of your cache servers. You would also need to make sure +that the cache servers are configured to accept incoming connections from the Nginx server and handle requests for files. + +```` \ No newline at end of file diff --git a/examples/mario/Modelfile b/examples/base-modelfile-mario/Modelfile similarity index 100% rename from examples/mario/Modelfile rename to examples/base-modelfile-mario/Modelfile diff --git a/examples/mario/logo.png b/examples/base-modelfile-mario/logo.png similarity index 100% rename from examples/mario/logo.png rename to examples/base-modelfile-mario/logo.png diff --git a/examples/mario/readme.md b/examples/base-modelfile-mario/readme.md similarity index 100% rename from examples/mario/readme.md rename to examples/base-modelfile-mario/readme.md diff --git a/examples/base-modelfile-midjourney/Modelfile b/examples/base-modelfile-midjourney/Modelfile new file mode 100644 index 00000000..76e0875c --- /dev/null +++ b/examples/base-modelfile-midjourney/Modelfile @@ -0,0 +1,11 @@ +# Modelfile for creating a Midjourney prompts from a topic +# This prompt was adapted from the original at https://www.greataiprompts.com/guide/midjourney/best-chatgpt-prompt-for-midjourney/ +# Run `ollama create mj -f ./Modelfile` and then `ollama run mj` and enter a topic + +FROM zephyr +PARAMETER temperature 0.8 +PARAMETER top_k 500 +PARAMETER top_p 0.9 +SYSTEM """ +Embrace your role as a creative illustrator. Based on a concept provided, you must produce a single paragraph with a multifaceted description of an image, ensuring significant details of the concept and more is represented in your instructions. You do not need to write complete sentences but rather short concepts with the following information: the level of detail that should be represented, an artistic style and maybe a specific name of a painter or illustrator, the ideal color pallete, lighting, mood, perspective, the setting, time of day, weather, the season, the time period, location, materials, the textures, patterns, lines, brushstrokes, techniques, the medium, the genre, the rendering style. Don't include everything and keep the description length under 250 words. +""" diff --git a/examples/base-modelfile-midjourney/README.md b/examples/base-modelfile-midjourney/README.md new file mode 100644 index 00000000..442b9767 --- /dev/null +++ b/examples/base-modelfile-midjourney/README.md @@ -0,0 +1,11 @@ +# Midjourney Prompt Generator Modelfile + +This simple modelfile will help create a prompt to feed to Midjourney. + +```text +ollama create midjourney + +ollama run midjourney +>>> a sports car in the mountains. +A sleek, high-performance automobile cuts through a serpentine mountain landscape. The concept is a classic illustration of speed and power, depicted in the style of pop art by Andy Warhol. The color palette is dominated by bold, primary hues of red, blue, and yellow, with striking accent colors of white, black, and metallic shades. The lighting is bright and focused, casting sharp shadows on the rugged terrain. A sense of excitement and anticipation permeates throughout the scene, as the car navigates a treacherous course through the winding road. The perspective is low, allowing for a full view of the vehicle's sleek lines and intricate details. The setting takes place in the afternoon during a sunny day in autumn, as evidenced by the vibrant foliage on the mountainside. The time period is modern, with nods to classic car design. The materials are primarily digital, allowing for smooth curves and sharp contrasts. The textures are sleek and polished, with meticulously detailed lines and brushstrokes that accentuate the car's aerodynamic design. The patterns consist of geometric shapes and bold stripes, adding to the car's dynamic appeal. The genre is modern realism, with a focus on precision and detail. The rendering style is highly technical, capturing the nuances and subtleties of the vehicle and its surroundings in breathtaking detail. +``` diff --git a/examples/recipemaker/Modelfile b/examples/base-modelfile-recipemaker/Modelfile similarity index 100% rename from examples/recipemaker/Modelfile rename to examples/base-modelfile-recipemaker/Modelfile diff --git a/examples/base-modelfile-recipemaker/README.md b/examples/base-modelfile-recipemaker/README.md new file mode 100644 index 00000000..038522a7 --- /dev/null +++ b/examples/base-modelfile-recipemaker/README.md @@ -0,0 +1,20 @@ +# Recipe Maker Modelfile + +Simple modelfile to generate a recipe from a short list of ingredients. + +``` +ollama create recipemaker + +ollama run recipemaker +>>> chilli pepper, white chocolate, kale + Ingredients: +- 1 small chili pepper +- 4 squares of white chocolate +- handful of kale leaves + +Instructions: +1. In a blender or food processor, puree the chilies and white chocolate until smooth. +2. Add the chopped kale leaves to the blender and pulse until well combined. +3. Serve immediately as a dip for crackers or use it as an ingredient in your favorite recipe. The mixture of spicy chili pepper with sweet white chocolate and nutritious +kale will make your taste buds dance with delight! +``` \ No newline at end of file diff --git a/examples/sentiments/Modelfile b/examples/base-modelfile-sentiments/Modelfile similarity index 100% rename from examples/sentiments/Modelfile rename to examples/base-modelfile-sentiments/Modelfile diff --git a/examples/sentiments/Readme.md b/examples/base-modelfile-sentiments/Readme.md similarity index 100% rename from examples/sentiments/Readme.md rename to examples/base-modelfile-sentiments/Readme.md diff --git a/examples/tweetwriter/Modelfile b/examples/base-modelfile-tweetwriter/Modelfile similarity index 100% rename from examples/tweetwriter/Modelfile rename to examples/base-modelfile-tweetwriter/Modelfile diff --git a/examples/ask-the-mentors/.gitignore b/examples/base-nodejs-mentors/.gitignore similarity index 100% rename from examples/ask-the-mentors/.gitignore rename to examples/base-nodejs-mentors/.gitignore diff --git a/examples/ask-the-mentors/README.md b/examples/base-nodejs-mentors/README.md similarity index 100% rename from examples/ask-the-mentors/README.md rename to examples/base-nodejs-mentors/README.md diff --git a/examples/ask-the-mentors/character-generator.ts b/examples/base-nodejs-mentors/character-generator.ts similarity index 100% rename from examples/ask-the-mentors/character-generator.ts rename to examples/base-nodejs-mentors/character-generator.ts diff --git a/examples/ask-the-mentors/mentors.ts b/examples/base-nodejs-mentors/mentors.ts similarity index 100% rename from examples/ask-the-mentors/mentors.ts rename to examples/base-nodejs-mentors/mentors.ts diff --git a/examples/ask-the-mentors/package.json b/examples/base-nodejs-mentors/package.json similarity index 100% rename from examples/ask-the-mentors/package.json rename to examples/base-nodejs-mentors/package.json diff --git a/examples/dockerit/Modelfile b/examples/base-python-dockerit/Modelfile similarity index 98% rename from examples/dockerit/Modelfile rename to examples/base-python-dockerit/Modelfile index da5c1c07..acd63644 100644 --- a/examples/dockerit/Modelfile +++ b/examples/base-python-dockerit/Modelfile @@ -1,4 +1,4 @@ -FROM llama2 +FROM mistral SYSTEM """ You are an experienced Devops engineer focused on docker. When given specifications for a particular need or application you know the best way to host that within a docker container. For instance if someone tells you they want an nginx server to host files located at /web you will answer as follows diff --git a/examples/dockerit/README.md b/examples/base-python-dockerit/README.md similarity index 100% rename from examples/dockerit/README.md rename to examples/base-python-dockerit/README.md diff --git a/examples/dockerit/dockerit.py b/examples/base-python-dockerit/dockerit.py similarity index 100% rename from examples/dockerit/dockerit.py rename to examples/base-python-dockerit/dockerit.py diff --git a/examples/dockerit/requirements.txt b/examples/base-python-dockerit/requirements.txt similarity index 100% rename from examples/dockerit/requirements.txt rename to examples/base-python-dockerit/requirements.txt diff --git a/examples/python/client.py b/examples/base-python-simplegenerate/client.py similarity index 100% rename from examples/python/client.py rename to examples/base-python-simplegenerate/client.py diff --git a/examples/langchain-document/README.md b/examples/langchain-python-rag-document/README.md similarity index 100% rename from examples/langchain-document/README.md rename to examples/langchain-python-rag-document/README.md diff --git a/examples/langchain-document/main.py b/examples/langchain-python-rag-document/main.py similarity index 100% rename from examples/langchain-document/main.py rename to examples/langchain-python-rag-document/main.py diff --git a/examples/langchain-document/requirements.txt b/examples/langchain-python-rag-document/requirements.txt similarity index 100% rename from examples/langchain-document/requirements.txt rename to examples/langchain-python-rag-document/requirements.txt diff --git a/examples/privategpt/.gitignore b/examples/langchain-python-rag-privategpt/.gitignore similarity index 100% rename from examples/privategpt/.gitignore rename to examples/langchain-python-rag-privategpt/.gitignore diff --git a/examples/privategpt/LICENSE b/examples/langchain-python-rag-privategpt/LICENSE similarity index 100% rename from examples/privategpt/LICENSE rename to examples/langchain-python-rag-privategpt/LICENSE diff --git a/examples/privategpt/README.md b/examples/langchain-python-rag-privategpt/README.md similarity index 100% rename from examples/privategpt/README.md rename to examples/langchain-python-rag-privategpt/README.md diff --git a/examples/privategpt/constants.py b/examples/langchain-python-rag-privategpt/constants.py similarity index 100% rename from examples/privategpt/constants.py rename to examples/langchain-python-rag-privategpt/constants.py diff --git a/examples/privategpt/ingest.py b/examples/langchain-python-rag-privategpt/ingest.py similarity index 100% rename from examples/privategpt/ingest.py rename to examples/langchain-python-rag-privategpt/ingest.py diff --git a/examples/privategpt/poetry.lock b/examples/langchain-python-rag-privategpt/poetry.lock similarity index 100% rename from examples/privategpt/poetry.lock rename to examples/langchain-python-rag-privategpt/poetry.lock diff --git a/examples/privategpt/privateGPT.py b/examples/langchain-python-rag-privategpt/privateGPT.py similarity index 100% rename from examples/privategpt/privateGPT.py rename to examples/langchain-python-rag-privategpt/privateGPT.py diff --git a/examples/privategpt/pyproject.toml b/examples/langchain-python-rag-privategpt/pyproject.toml similarity index 100% rename from examples/privategpt/pyproject.toml rename to examples/langchain-python-rag-privategpt/pyproject.toml diff --git a/examples/privategpt/requirements.txt b/examples/langchain-python-rag-privategpt/requirements.txt similarity index 100% rename from examples/privategpt/requirements.txt rename to examples/langchain-python-rag-privategpt/requirements.txt diff --git a/examples/langchain-web-summary/README.md b/examples/langchain-python-rag-websummary/README.md similarity index 100% rename from examples/langchain-web-summary/README.md rename to examples/langchain-python-rag-websummary/README.md diff --git a/examples/langchain-web-summary/main.py b/examples/langchain-python-rag-websummary/main.py similarity index 100% rename from examples/langchain-web-summary/main.py rename to examples/langchain-python-rag-websummary/main.py diff --git a/examples/langchain-web-summary/requirements.txt b/examples/langchain-python-rag-websummary/requirements.txt similarity index 100% rename from examples/langchain-web-summary/requirements.txt rename to examples/langchain-python-rag-websummary/requirements.txt diff --git a/examples/langchain/README.md b/examples/langchain-python-simplegenerate/README.md similarity index 100% rename from examples/langchain/README.md rename to examples/langchain-python-simplegenerate/README.md diff --git a/examples/langchain/main.py b/examples/langchain-python-simplegenerate/main.py similarity index 100% rename from examples/langchain/main.py rename to examples/langchain-python-simplegenerate/main.py diff --git a/examples/langchain/requirements.txt b/examples/langchain-python-simplegenerate/requirements.txt similarity index 100% rename from examples/langchain/requirements.txt rename to examples/langchain-python-simplegenerate/requirements.txt diff --git a/examples/midjourney-prompter/Modelfile b/examples/midjourney-prompter/Modelfile deleted file mode 100644 index c46017b7..00000000 --- a/examples/midjourney-prompter/Modelfile +++ /dev/null @@ -1,8 +0,0 @@ -# Modelfile for creating a Midjourney prompts from a topic -# This prompt was adapted from the original at https://www.greataiprompts.com/guide/midjourney/best-chatgpt-prompt-for-midjourney/ -# Run `ollama create mj -f ./Modelfile` and then `ollama run mj` and enter a topic - -FROM nous-hermes -SYSTEM """ -Embrace your role as an AI-powered creative assistant, employing Midjourney to manifest compelling AI-generated art. I will outline a specific image concept, and in response, you must produce an exhaustive, multifaceted prompt for Midjourney, ensuring every detail of the original concept is represented in your instructions. Midjourney doesn't do well with text, so after the prompt, give me instructions that I can use to create the titles in a image editor. -"""