Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion docs/custom-evaluators.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pip install agentevals-evaluator-sdk
# evaluators/response_quality.py
from agentevals_evaluator_sdk import evaluator, EvalInput, EvalResult


@evaluator
def response_quality(input: EvalInput) -> EvalResult:
scores = []
Expand All @@ -53,6 +54,7 @@ def response_quality(input: EvalInput) -> EvalResult:
per_invocation_scores=scores,
)


if __name__ == "__main__":
response_quality.run()
```
Expand Down Expand Up @@ -436,7 +438,7 @@ Then register it:
_RUNTIMES: list[Runtime] = [
PythonRuntime(),
NodeRuntime(),
GoRuntime(), # new
GoRuntime(), # new
]
```

Expand Down Expand Up @@ -484,6 +486,7 @@ To support a different evaluator registry (e.g., a custom API), implement `Evalu
```python
from agentevals.evaluator.sources import EvaluatorSource, EvaluatorInfo, register_source


class MyRegistrySource(EvaluatorSource):
@property
def source_name(self) -> str:
Expand All @@ -492,6 +495,7 @@ class MyRegistrySource(EvaluatorSource):
async def list_evaluators(self) -> list[EvaluatorInfo]: ...
async def fetch_evaluator(self, ref: str, dest: Path) -> Path: ...


register_source(MyRegistrySource())
```

Expand Down
2 changes: 2 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ For simple prompt-to-response agents, there's also a decorator shorthand:
```python
app = AgentEvals(eval_set_id="my-eval")


@app.agent
def my_agent(prompt):
return llm.invoke(prompt).content


app.run(["Hello!", "Tell me a joke"])
```

Expand Down
9 changes: 2 additions & 7 deletions examples/dice_agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,8 @@ Add a new tool in `agent.py`:
def roll_multiple(count: int, sides: int = 6) -> dict:
"""Roll multiple dice at once."""
results = [random.randint(1, sides) for _ in range(count)]
return {
"count": count,
"sides": sides,
"results": results,
"total": sum(results),
"average": sum(results) / count
}
return {"count": count, "sides": sides, "results": results, "total": sum(results), "average": sum(results) / count}


dice_agent = Agent(
name="dice_agent",
Expand Down
4 changes: 3 additions & 1 deletion examples/langchain_agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ os.environ["OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"] = "true"

```python
tracer_provider = TracerProvider() # For spans
logger_provider = LoggerProvider() # For logs
logger_provider = LoggerProvider() # For logs
```

**Both are required** - spans provide metadata, logs provide message content.
Expand All @@ -164,10 +164,12 @@ The log processor shares the WebSocket connection from the span processor.
```python
loop = asyncio.new_event_loop()


def run_loop_in_background():
asyncio.set_event_loop(loop)
loop.run_forever()


thread = threading.Thread(target=run_loop_in_background, daemon=True)
thread.start()
```
Expand Down
2 changes: 2 additions & 0 deletions packages/evaluator-sdk-py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pip install agentevals-evaluator-sdk
```python
from agentevals_evaluator_sdk import evaluator, EvalInput, EvalResult


@evaluator
def my_evaluator(input: EvalInput) -> EvalResult:
scores = []
Expand All @@ -27,6 +28,7 @@ def my_evaluator(input: EvalInput) -> EvalResult:
per_invocation_scores=scores,
)


if __name__ == "__main__":
my_evaluator.run()
```
Expand Down
Loading