mirror of
https://github.com/run-llama/fs-explorer.git
synced 2026-07-01 21:45:00 -04:00
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
from google.genai.types import (
|
|
HttpOptions,
|
|
Content,
|
|
GenerateContentResponse,
|
|
Candidate,
|
|
Part,
|
|
)
|
|
from fs_explorer.models import StopAction, Action
|
|
|
|
|
|
class MockModels:
|
|
async def generate_content(self, *args, **kwargs) -> GenerateContentResponse:
|
|
return GenerateContentResponse(
|
|
candidates=[
|
|
Candidate(
|
|
content=Content(
|
|
role="assistant",
|
|
parts=[
|
|
Part.from_text(
|
|
text=Action(
|
|
action=StopAction(
|
|
final_result="this is a final result"
|
|
),
|
|
reason="I am done",
|
|
).model_dump_json()
|
|
)
|
|
],
|
|
)
|
|
)
|
|
]
|
|
)
|
|
|
|
|
|
class MockAio:
|
|
@property
|
|
def models(self):
|
|
return MockModels()
|
|
|
|
|
|
class MockGenAIClient:
|
|
def __init__(self, api_key: str, http_options: HttpOptions) -> None:
|
|
return None
|
|
|
|
@property
|
|
def aio(self) -> MockAio:
|
|
return MockAio()
|