mirror of
https://github.com/Mintplex-Labs/langchain-python.git
synced 2026-08-27 01:15:22 -04:00
fd69cc7e42
Removed duplicate BaseModel dependencies in class inheritances. Also, sorted imports by `isort`.
27 lines
674 B
Python
27 lines
674 B
Python
"""Fake LLM wrapper for testing purposes."""
|
|
from typing import Any, List, Mapping, Optional
|
|
|
|
from langchain.llms.base import LLM
|
|
|
|
|
|
class FakeListLLM(LLM):
|
|
"""Fake LLM wrapper for testing purposes."""
|
|
|
|
responses: List
|
|
i: int = 0
|
|
|
|
@property
|
|
def _llm_type(self) -> str:
|
|
"""Return type of llm."""
|
|
return "fake-list"
|
|
|
|
def _call(self, prompt: str, stop: Optional[List[str]] = None) -> str:
|
|
"""First try to lookup in queries, else return 'foo' or 'bar'."""
|
|
response = self.responses[self.i]
|
|
self.i += 1
|
|
return response
|
|
|
|
@property
|
|
def _identifying_params(self) -> Mapping[str, Any]:
|
|
return {}
|