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
5 changes: 0 additions & 5 deletions contextual_orchestrator/batch_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,6 @@ def _extract_answer(body: Dict[str, Any]) -> str:
return str(message.get("content", ""))


def build_jsonl_body(requests: List[BatchRequest], endpoint: str = "/v1/chat/completions") -> str:
"""Serialize batch requests into an OpenAI Batch API JSONL body."""
return "\n".join(json.dumps(request.to_jsonl_line(endpoint)) for request in requests)
Comment thread
seonghobae marked this conversation as resolved.
Resolved


# ---------------------------------------------------------------------------
# Embeddings batch requests / results / backends
# ---------------------------------------------------------------------------
Expand Down
9 changes: 0 additions & 9 deletions tests/test_batch_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
PgLlmBatchEmbeddingBackend,
RoutingHints,
RoutingPolicy,
build_jsonl_body,
cheapest_upstream,
)
from contextual_orchestrator.cost_ledger import PriceBook, PriceEntry # noqa: E402
Expand Down Expand Up @@ -235,14 +234,6 @@ async def download_results(self, batch_id, endpoint_alias):
assert backend.retrieve(job) == []


def test_build_jsonl_body_uses_openai_batch_line_shape() -> None:
requests = [BatchRequest(messages=[{"role": "user", "content": "hi"}], custom_id="a", model="gpt-x")]
body = build_jsonl_body(requests)
assert '"custom_id": "a"' in body
assert '"url": "/v1/chat/completions"' in body
assert '"method": "POST"' in body


def test_pg_llm_embedding_batch_preserves_agent_identity() -> None:
class _Assembler:
def __init__(self) -> None:
Expand Down
Loading