Skip to content

Commit fcff843

Browse files
author
Dylan Huang
authored
simple supabase example w/ chinook (#123)
* supabase example * remove ModelConfig * fix reasoning -> reason * more
1 parent 1a9d702 commit fcff843

File tree

9 files changed

+16252
-5
lines changed

9 files changed

+16252
-5
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ jobs:
8686
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
8787
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }}
8888
FIREWORKS_ACCOUNT_ID: ${{ secrets.FIREWORKS_ACCOUNT_ID }}
89+
SUPABASE_PASSWORD: ${{ secrets.SUPABASE_PASSWORD }}
90+
SUPABASE_HOST: ${{ secrets.SUPABASE_HOST }}
91+
SUPABASE_PORT: ${{ secrets.SUPABASE_PORT }}
92+
SUPABASE_DATABASE: ${{ secrets.SUPABASE_DATABASE }}
93+
SUPABASE_USER: ${{ secrets.SUPABASE_USER }}
8994
PYTHONWARNINGS: "ignore::DeprecationWarning,ignore::RuntimeWarning"
9095
run: |
9196
# Run most tests in parallel, but explicitly ignore tests that manage their own servers or are slow

eval_protocol/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,13 @@ def get_assistant_messages(self) -> List[Message]:
572572
"""Returns only the assistant messages from the conversation."""
573573
return [msg for msg in self.messages if msg.role == "assistant"]
574574

575+
def last_assistant_message(self) -> Optional[Message]:
576+
"""Returns the last assistant message from the conversation. Returns None if none found."""
577+
assistant_messages = self.get_assistant_messages()
578+
if not assistant_messages:
579+
return None
580+
return assistant_messages[-1]
581+
575582
def get_user_messages(self) -> List[Message]:
576583
"""Returns only the user messages from the conversation."""
577584
return [msg for msg in self.messages if msg.role == "user"]

eval_protocol/pytest/default_pydantic_ai_rollout_processor.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import types
44
from typing import List
55

6+
from attr import dataclass
67
from openai.types.chat.chat_completion_assistant_message_param import ChatCompletionAssistantMessageParam
78

89
from eval_protocol.models import EvaluationRow, Message
@@ -23,6 +24,7 @@
2324
UserPromptPart,
2425
)
2526
from pydantic_ai.providers.openai import OpenAIProvider
27+
from typing_extensions import TypedDict
2628

2729
logger = logging.getLogger(__name__)
2830

@@ -58,10 +60,10 @@ def __call__(self, rows: List[EvaluationRow], config: RolloutProcessorConfig) ->
5860
"completion_params['model'] must be a dict mapping agent argument names to model config dicts (with 'model' and 'provider' keys)"
5961
)
6062
kwargs = {}
61-
for model_name, model_config in config.completion_params["model"].items():
62-
kwargs[model_name] = OpenAIModel(
63-
model_config["model"],
64-
provider=model_config["provider"],
63+
for k, v in config.completion_params["model"].items():
64+
kwargs[k] = OpenAIModel(
65+
v["model"],
66+
provider=v["provider"],
6567
)
6668
agent = setup_agent(**kwargs)
6769
model = None

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ svgbench = [
125125
pydantic = [
126126
"pydantic-ai",
127127
]
128+
supabase = [
129+
"supabase>=2.18.1",
130+
]
131+
chinook = [
132+
"psycopg2-binary>=2.9.10",
133+
]
128134

129135
[tool.pytest.ini_options]
130136
addopts = "-q"

0 commit comments

Comments
 (0)