From 8691652e67844c0f3829171aa0572a89ea98b757 Mon Sep 17 00:00:00 2001 From: Omar Khattab Date: Tue, 12 Nov 2024 14:05:30 -0800 Subject: [PATCH] edit language_models.md --- docs/docs/learn/programming/language_models.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/docs/learn/programming/language_models.md b/docs/docs/learn/programming/language_models.md index 93a4fd8aa..0656e72f4 100644 --- a/docs/docs/learn/programming/language_models.md +++ b/docs/docs/learn/programming/language_models.md @@ -7,12 +7,21 @@ sidebar_position: 2 The first step in any DSPy code is to set up your language model. For example, you can configure OpenAI's GPT-4o-mini as your default LM as follows. ```python -# Authenticate via the `OPENAI_API_KEY` env variable or by passing an `api_key` argument below. +# Authenticate via the `OPENAI_API_KEY` env variable. lm = dspy.LM('openai/gpt-4o-mini') dspy.configure(lm=lm) ``` -!!! info "Other LMs" +!!! info "A few different LMs" + + === "OpenAI" + You can authenticate by setting the `OPENAI_API_KEY` env variable or passing `api_key` below. + + ```python linenums="1" + import dspy + lm = dspy.LM('openai/gpt-4o-mini', api_key='YOUR_OPENAI_API_KEY') + dspy.configure(lm=lm) + ``` === "Anthropic" You can authenticate by setting the ANTHROPIC_API_KEY env variable or passing `api_key` below.