Skip to content

Commit

Permalink
fix small syntax errors in prompt engineering how-to (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
isahers1 authored Jan 22, 2025
2 parents 3e5b9e2 + c1dc8a2 commit 3063016
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ To create a new prompt or update an existing prompt, you can use the `push promp

<CodeTabs
tabs={[
PythonBlock(`from langsmith import client
PythonBlock(`from langsmith import Client
from langchain_core.prompts import ChatPromptTemplate\n
client = Client()\n
prompt = ChatPromptTemplate.from_template("tell me a joke about {topic}")
Expand All @@ -77,7 +77,9 @@ print(url)
TypeScriptBlock(`import * as hub from "langchain/hub";
import { ChatPromptTemplate } from "@langchain/core/prompts";\n
const prompt = ChatPromptTemplate.fromTemplate("tell me a joke about {topic}");
const url = hub.push("joke-generator", chain);
const url = hub.push("joke-generator", {
object: prompt,
});
// url is a link to the prompt in the UI
console.log(url);
`),
Expand All @@ -91,7 +93,7 @@ The provider must be supported by the LangSmith playground. (see settings here:

<CodeTabs
tabs={[
PythonBlock(`from langsmith import client
PythonBlock(`from langsmith import Client
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI\n
client = Client()
Expand All @@ -116,7 +118,9 @@ import { ChatOpenAI } from "@langchain/openai";\n
const model = new ChatOpenAI({ model: "gpt-4o-mini" });\n
const prompt = ChatPromptTemplate.fromTemplate("tell me a joke about {topic}");
const chain = prompt.pipe(model);\n
await hub.push("joke-generator-with-model", chain);`),
await hub.push("joke-generator-with-model", {
object: chain
});`),
]}
groupId="client-language"
/>
Expand All @@ -131,7 +135,7 @@ To pull a **public prompt** from the LangChain Hub, you need to specify the hand

<CodeTabs
tabs={[
PythonBlock(`from langsmith import client
PythonBlock(`from langsmith import Client
from langchain_openai import ChatOpenAI\n
client = Client()\n
prompt = client.pull_prompt("joke-generator")
Expand Down Expand Up @@ -161,7 +165,7 @@ Make sure you have the proper environment variables set for the model you are us

<CodeTabs
tabs={[
PythonBlock(`from langsmith import client\n
PythonBlock(`from langsmith import Client\n
client = Client()
chain = client.pull_prompt("joke-generator-with-model", include_model=True)
chain.invoke({"topic": "cats"})`),
Expand Down

0 comments on commit 3063016

Please sign in to comment.