Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Added Ollama and Together model usage information

Insop Songd57558f95482
diff --git a/docs/guides/language_model_details/launching_ollama.md b/docs/guides/language_model_details/launching_ollama.md
new file mode 100644
index 000000000..242fc6ec7
--- /dev/null
+++ b/docs/guides/language_model_details/launching_ollama.md
@@ -0,0 +1,41 @@
+## Setting up an Ollama language model
+
+Ollama is a good software tool that allows you to run LLMs locally, such as Mistral, Llama2, and Phi.
+The following are the instructions to install and run Ollama.
+
+### Prerequisites
+
+Install Ollama by following the instructions from this page:
+
+- https://ollama.ai
+
+Download model: `ollama pull`
+
+Download a model by running the `ollama pull` command. You can download Mistral, Llama2, and Phi.
+
+```bash
+# download mistral
+ollama pull mistral
+```
+
+Here is the list of other models you can download:
+- https://ollama.ai/library
+
+### Running Ollama model
+
+Run model: `ollama run`
+
+You can test a model by running the model with the `ollama run` command.
+
+```bash
+# run mistral
+ollama run mistral
+```
+
+### Sending requests to the server
+
+Here is the code to load a model through Ollama:
+
+```python
+lm = dspy.OllamaLocal(model='mistral')
+```
diff --git a/docs/guides/language_models.ipynb b/docs/guides/language_models.ipynb
index eaf9f2003..8313bf914 100644
--- a/docs/guides/language_models.ipynb
+++ b/docs/guides/language_models.ipynb
@@ -71,7 +71,7 @@
"\n",
"3. `dspy.Anyscale` for hosted Llama2 models.\n",
"\n",
- "\n",
+ "4. `dspy.Together` for hosted various open source models.\n",
"\n",
"#### Local LMs.\n",
"\n",
@@ -83,7 +83,8 @@
"\n",
"6. `dspy.HFModel` (experimental)\n",
"\n",
- "7. `dspy.Ollama` (experimental)\n",
+ "7. `dspy.Ollama` (experimental) for open source models through [Ollama](https://ollama.com). [Tutorial: How do I install and use Ollama on a local computer?](language_model_details/launching_ollama.md)\n",
+ "\n",
"\n",
"8. `dspy.ChatModuleClient` (experimental): [How do I install and use MLC?](language_model_details/launching_mlc.md)\n",
"\n",
@@ -116,6 +117,8 @@
"\n",
"# cohere = dspy.Cohere(...)\n",
"# anyscale = dspy.Anyscale(...)\n",
+ "# together = dspy.Together(...)\n",
+ "# ollama = dspy.OllamaLocal(...)\n",
"# tgi_llama2 = dspy.HFClientTGI(model=\"meta-llama/Llama-2-7b-hf\", port=8080, url=\"http://localhost\")\n",
"\n",
"dspy.configure(lm=gpt3_turbo)"