Mock chat function for testing
(
self,
messages: Union[str, List[lm.LLMMessage]],
max_tokens: int = 200,
tools: Optional[List[OpenAIToolSpec]] = None,
tool_choice: ToolChoiceTypes | Dict[str, str | Dict[str, str]] = "auto",
functions: Optional[List[lm.LLMFunctionSpec]] = None,
function_call: str | Dict[str, str] = "auto",
response_format: Optional[OpenAIJsonSchemaSpec] = None,
)
| 91 | return self._response(last_msg) |
| 92 | |
| 93 | async def achat( |
| 94 | self, |
| 95 | messages: Union[str, List[lm.LLMMessage]], |
| 96 | max_tokens: int = 200, |
| 97 | tools: Optional[List[OpenAIToolSpec]] = None, |
| 98 | tool_choice: ToolChoiceTypes | Dict[str, str | Dict[str, str]] = "auto", |
| 99 | functions: Optional[List[lm.LLMFunctionSpec]] = None, |
| 100 | function_call: str | Dict[str, str] = "auto", |
| 101 | response_format: Optional[OpenAIJsonSchemaSpec] = None, |
| 102 | ) -> lm.LLMResponse: |
| 103 | """ |
| 104 | Mock chat function for testing |
| 105 | """ |
| 106 | last_msg = messages[-1].content if isinstance(messages, list) else messages |
| 107 | return await self._response_async(last_msg) |
| 108 | |
| 109 | def generate(self, prompt: str, max_tokens: int = 200) -> lm.LLMResponse: |
| 110 | """ |