File size: 562 Bytes
732b14f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Coverage anchor for LCEL invoke helpers."""

from __future__ import annotations

import pytest

from app.llm.lcel_invoke import invoke_lcel_chain


@pytest.mark.asyncio
async def test_invoke_lcel_chain_mock_chain() -> None:
    class _Chain:
        async def ainvoke(self, variables: dict) -> str:
            return f"ok:{variables.get('x')}"

        def invoke(self, variables: dict) -> str:
            return f"sync:{variables.get('x')}"

    out = await invoke_lcel_chain(_Chain(), {"x": "1"}, phase="test")
    assert "ok:1" in out or "sync:1" in out