Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a33d248
chore: add blog post
maxdeichmann Feb 10, 2026
5e09108
chore: add blog post
maxdeichmann Feb 10, 2026
2d40d02
chore: add blog post
maxdeichmann Feb 10, 2026
471d236
chore: add blog post
maxdeichmann Feb 10, 2026
24c0607
chore: add blog post
maxdeichmann Feb 11, 2026
bb9242b
Merge branch 'main' into add-perf-changelog
maxdeichmann Feb 11, 2026
9a9967a
chore: add blog post
maxdeichmann Feb 11, 2026
be888b8
chore: add blog post
maxdeichmann Feb 11, 2026
f7b4b86
chore: add blog post
maxdeichmann Feb 11, 2026
f6953d3
chore: add blog post
maxdeichmann Feb 11, 2026
e983d84
chore: add blog post
maxdeichmann Feb 11, 2026
49c81a6
chore: add blog post
maxdeichmann Feb 11, 2026
a0d28f2
Merge branch 'main' into add-perf-changelog
maxdeichmann Feb 11, 2026
9492661
add links, add toggle image, add numbers to headline
jannikmaierhoefer Feb 11, 2026
8e63818
chore: add blog post
maxdeichmann Feb 11, 2026
9c49a7c
chore: add blog post
maxdeichmann Feb 11, 2026
5a1836f
fix typo + add link
Lotte-Verheyden Feb 12, 2026
48486b1
docs: link llm-as-a-judge docs
marliessophie Feb 12, 2026
23e7612
chore: add blog post
maxdeichmann Feb 12, 2026
0360624
chore: push
maxdeichmann Feb 13, 2026
683c913
chore: push
maxdeichmann Feb 13, 2026
de4dff2
docs: add SDK major upgrade migration docs (#2522)
hassiebp Feb 17, 2026
3bd7ca9
docs!: default span filtering (#2567)
hassiebp Feb 24, 2026
b797bbf
push
hassiebp Feb 24, 2026
456b572
chore: add test comment to README
jannikmaierhoefer Feb 25, 2026
c1916d6
Revert "chore: add test comment to README"
jannikmaierhoefer Feb 25, 2026
3e90436
docs: clarify v4 export source guidance (#2603)
hassiebp Mar 5, 2026
707d789
chore: add note for self-hosted deployments
Steffen911 Mar 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 2 additions & 68 deletions cookbook/example_evaluating_multi_turn_conversations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,73 +111,7 @@
"id": "d3f4e177"
},
"outputs": [],
"source": [
"# This is a simple cooking assistant chatbot traced with Langfuse and uses OpenAI as the LLM.\n",
"from langfuse.openai import openai\n",
"from langfuse import get_client, observe\n",
"\n",
"\n",
"\n",
"class SimpleChat:\n",
" def __init__(self, model=\"gpt-3.5-turbo\"):\n",
" self.conversation_history = [\n",
" {\n",
" \"role\": \"system\",\n",
" \"content\": \"You are a helpful cooking assistant that answers questions about recipes and cooking.\"\n",
" }\n",
" ]\n",
" self.model = model\n",
"\n",
" @observe\n",
" def add_message(self, messages):\n",
" \"\"\"\n",
" Args:\n",
" messages: Either a string (single user message) or a list of message dictionaries\n",
" \"\"\"\n",
" try:\n",
" # Handle both string and array inputs\n",
" if isinstance(messages, str):\n",
" messages = [{\"role\": \"user\", \"content\": messages}]\n",
"\n",
" # Add messages to history\n",
" self.conversation_history.extend(messages)\n",
"\n",
" # Call OpenAI API using the new client\n",
" response = openai.chat.completions.create(\n",
" model=self.model,\n",
" messages=self.conversation_history,\n",
" max_tokens=500,\n",
" temperature=0.7\n",
" )\n",
"\n",
" # Extract and add assistant response\n",
" assistant_message = response.choices[0].message.content\n",
" self.conversation_history.append({\"role\": \"assistant\", \"content\": assistant_message})\n",
" get_client().update_current_trace(input=messages, output=assistant_message)\n",
"\n",
" return assistant_message\n",
"\n",
" except Exception as e:\n",
" return f\"Error: {str(e)}\"\n",
"\n",
" def show_history(self):\n",
" import json\n",
" print(\"Conversation history:\")\n",
" print(json.dumps(self.conversation_history, indent=2))\n",
" print()\n",
"\n",
" def clear_history(self):\n",
" self.conversation_history = [\n",
" {\n",
" \"role\": \"system\",\n",
" \"content\": \"You are a helpful cooking assistant that answers questions about recipes and cooking.\"\n",
" }\n",
" ]\n",
" print(\"Conversation cleared!\")\n",
"\n",
"# Create a chat instance\n",
"chat = SimpleChat()"
]
"source": "# This is a simple cooking assistant chatbot traced with Langfuse and uses OpenAI as the LLM.\nfrom langfuse.openai import openai\nfrom langfuse import get_client, observe\n\n\n\nclass SimpleChat:\n def __init__(self, model=\"gpt-3.5-turbo\"):\n self.conversation_history = [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful cooking assistant that answers questions about recipes and cooking.\"\n }\n ]\n self.model = model\n\n @observe\n def add_message(self, messages):\n \"\"\"\n Args:\n messages: Either a string (single user message) or a list of message dictionaries\n \"\"\"\n try:\n # Handle both string and array inputs\n if isinstance(messages, str):\n messages = [{\"role\": \"user\", \"content\": messages}]\n\n # Add messages to history\n self.conversation_history.extend(messages)\n\n # Call OpenAI API using the new client\n response = openai.chat.completions.create(\n model=self.model,\n messages=self.conversation_history,\n max_tokens=500,\n temperature=0.7\n )\n\n # Extract and add assistant response\n assistant_message = response.choices[0].message.content\n self.conversation_history.append({\"role\": \"assistant\", \"content\": assistant_message})\n get_client().update_current_observation(input=messages, output=assistant_message)\n\n return assistant_message\n\n except Exception as e:\n return f\"Error: {str(e)}\"\n\n def show_history(self):\n import json\n print(\"Conversation history:\")\n print(json.dumps(self.conversation_history, indent=2))\n print()\n\n def clear_history(self):\n self.conversation_history = [\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful cooking assistant that answers questions about recipes and cooking.\"\n }\n ]\n print(\"Conversation cleared!\")\n\n# Create a chat instance\nchat = SimpleChat()"
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -388,4 +322,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Loading