Skip to content

Commit f95fd73

Browse files
committed
add clarification on background judges
1 parent bdb80f7 commit f95fd73

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

examples/chat_judge_example.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ async def async_main():
6464
chat_response = await chat.invoke(user_input)
6565
print("Chat Response:", chat_response.message.content)
6666

67+
# Judge evaluations run asynchronously. Await them (e.g. with asyncio.gather) so they
68+
# complete before the process or request ends—even if you don't need to log or use
69+
# the results. Below we await and then log the results for demonstration.
70+
6771
# Log judge evaluation results with full detail
6872
if chat_response.evaluations is not None and len(chat_response.evaluations) > 0:
6973
# Note: Judge evaluations run asynchronously and do not block your application.

examples/chat_observability_example.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,18 @@ async def async_main():
9090

9191
user_input_2 = "Give me a specific use case example."
9292
print("\nUser Input:", user_input_2)
93-
93+
9494
response_2 = await chat.invoke(user_input_2)
9595
print("Chat Response:", response_2.message.content)
9696

97+
# Judge evaluations run asynchronously. Await them (e.g. with asyncio.gather) so they
98+
# complete before the process or request ends—even if you don't need to log or use
99+
# the results.
100+
if response_1.evaluations:
101+
await asyncio.gather(*response_1.evaluations)
102+
if response_2.evaluations:
103+
await asyncio.gather(*response_2.evaluations)
104+
97105
print("\nSuccess.")
98106

99107
except Exception as err:

examples/langgraph_agent_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def main():
9292
# enabled=True,
9393
# instructions='You are a helpful assistant.',
9494
# )
95-
# agent_config = aiclient.agent_config(LDAIAgentConfig(key=agent_config_key, default=default), context)
95+
# agent_config = aiclient.agent_config(agent_config_key, context, default=default)
9696
agent_config = aiclient.agent_config(
9797
LDAIAgentConfig(
9898
key=agent_config_key,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ direct-judge-example = 'examples.direct_judge_example:main'
2020

2121
[tool.poetry.dependencies]
2222
python = "^3.10"
23-
launchdarkly-server-sdk-ai = "^0.14.0"
23+
launchdarkly-server-sdk-ai = "^0.16.0"
2424
launchdarkly-server-sdk-ai-langchain = "^0.3.0"
2525
launchdarkly-server-sdk-ai-openai = "^0.1.0"
2626
launchdarkly-observability = { version = ">=0.1.0", optional = true }

0 commit comments

Comments
 (0)