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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
ORCHESTRATOR_TASK_LEDGER_FULL_PROMPT,
ORCHESTRATOR_TASK_LEDGER_PLAN_PROMPT,
ORCHESTRATOR_TASK_LEDGER_PLAN_UPDATE_PROMPT,
LedgerEntry,
)

trace_logger = logging.getLogger(TRACE_LOGGER_NAME)
Expand Down Expand Up @@ -309,7 +310,18 @@
assert self._max_json_retries > 0
key_error: bool = False
for _ in range(self._max_json_retries):
response = await self._model_client.create(self._get_compatible_context(context), json_output=True)
if self._model_client.model_info.get("structured_output", False):
response = await self._model_client.create(

Check warning on line 314 in python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_orchestrator.py

View check run for this annotation

Codecov / codecov/patch

python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_orchestrator.py#L314

Added line #L314 was not covered by tests
self._get_compatible_context(context), json_output=LedgerEntry
)
elif self._model_client.model_info.get("json_output", False):
response = await self._model_client.create(

Check warning on line 318 in python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_orchestrator.py

View check run for this annotation

Codecov / codecov/patch

python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_orchestrator.py#L318

Added line #L318 was not covered by tests
self._get_compatible_context(context), cancellation_token=cancellation_token, json_output=True
)
else:
response = await self._model_client.create(
self._get_compatible_context(context), cancellation_token=cancellation_token
)
ledger_str = response.content
try:
assert isinstance(ledger_str, str)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pydantic import BaseModel

ORCHESTRATOR_SYSTEM_MESSAGE = ""


Expand Down Expand Up @@ -98,6 +100,24 @@
"""


class LedgerEntryBooleanAnswer(BaseModel):
reason: str
answer: bool


class LedgerEntryStringAnswer(BaseModel):
reason: str
answer: str


class LedgerEntry(BaseModel):
is_request_satisfied: LedgerEntryBooleanAnswer
is_in_loop: LedgerEntryBooleanAnswer
is_progress_being_made: LedgerEntryBooleanAnswer
next_speaker: LedgerEntryStringAnswer
instruction_or_question: LedgerEntryStringAnswer


ORCHESTRATOR_TASK_LEDGER_FACTS_UPDATE_PROMPT = """As a reminder, we are working to solve the following task:

{task}
Expand Down
Loading