Conversation
b0fdb49 to
9204c29
Compare
|
Added some minimal unit testing for now, previousy there was no unit testing for ChatResponseMessage unless I missed something. So maybe in a separate PR more testing can be added. Changelog: where should I log the changes? |
Maybe @marikaner @alpkom can help regarding changelog? |
|
lgtm, and also I successfully ran the following e2e test: from gen_ai_hub.proxy.core import get_proxy_client
from gen_ai_hub.orchestration_v2.service import OrchestrationService
from gen_ai_hub.orchestration_v2.models.llm_model_details import LLMModelDetails
from gen_ai_hub.orchestration_v2.models.message import ReasoningBlock, SystemMessage, UserMessage
from gen_ai_hub.orchestration_v2.models.template import Template, PromptTemplatingModuleConfig
from gen_ai_hub.orchestration_v2.models.config import OrchestrationConfig, ModuleConfig
client = get_proxy_client(proxy_version="gen-ai-hub")
running = [d for d in client.ai_core_client.deployment.query(scenario_id="orchestration").resources if d.status.value == "RUNNING"]
api_url = running[0].deployment_url
service = OrchestrationService(api_url)
llm = LLMModelDetails(
name="anthropic--claude-4.5-sonnet",
params={
"temperature": 1.0,
"thinking": {"type": "enabled", "budget_tokens": 1024},
}
)
template = Template(template=[
SystemMessage(content="You are a helpful assistant."),
UserMessage(content="What is 17 * 23?"),
])
ptm = PromptTemplatingModuleConfig(prompt=template, model=llm)
config = OrchestrationConfig(modules=ModuleConfig(prompt_templating=ptm))
response = service.run(config=config)
parsed_msg = response.final_result.choices[0].message
if parsed_msg.reasoning_content:
print("Pydantic model correctly populated reasoning_content")
assert isinstance(parsed_msg.reasoning_content[0], ReasoningBlock)
print("isinstance(block, ReasoningBlock) = True")
else:
print("Pydantic model did NOT populate reasoning_content despite raw data present") |
|
Thanks! Should we add this to the e2e tests? |
In my opinion, unit tests also cover the minimal behavior change, so that's fine I guess. Adding it to e2e might increase the integration test duration unnecessarily, but what do you think? |
|
I was just wondering why this issue wasn't detected in e2e testing earlier. But maybe let's only add it once we fully support reasoning/thinking. |
A minimal fix to avoid Pydantic validation errors in case reasoning content is returned in the orchestration response. Later we should add convenience functionalities around reasoning content, but this is a larger project and imo out-of-scope of this fix PR.
I quickly checked manually that this fixes the issue. We should likely add some e2e/integration tests to ensure correctness (but those have been flaky recently). In case this PR is not urgent I can take care of this before merging.