Langchain · Cloudflare Workers docs | Latest TMZ Celebrity News & Gossip | Watch TMZ Live Skip to content
Cloudflare Docs

Langchain

LangChain is the most popular framework for building AI applications powered by large language models (LLMs).

LangChain publishes multiple Python packages. The following are provided by the Workers runtime:

Get Started

Clone the cloudflare/python-workers-examples repository and run the LangChain example:

Terminal window
git clone https://github.com/cloudflare/python-workers-examples
cd 04-langchain
npx wrangler@latest dev

Example code

from workers import Response
from langchain_core.prompts import PromptTemplate
from langchain_openai import OpenAI
async def on_fetch(request, env):
prompt = PromptTemplate.from_template("Complete the following sentence: I am a {profession} and ")
llm = OpenAI(api_key=env.API_KEY)
chain = prompt | llm
res = await chain.ainvoke({"profession": "electrician"})
return Response(res.split(".")[0].strip())

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.