Coder preparations
This commit is contained in:
@@ -6,11 +6,14 @@ class LLMClient:
|
||||
self.model = model
|
||||
self.client = OpenAI(base_url=base_url, api_key=api_key or "ollama")
|
||||
|
||||
def chat_with_schema(self, prompt: str, schema: dict):
|
||||
def chat_with_schema(self, prompt: str, schema: dict, system: str | None = None) -> str | None:
|
||||
assert_strict_mode_clean(schema)
|
||||
kwargs = {
|
||||
"model": self.model,
|
||||
"messages": [
|
||||
{"role": "system", "content": system},
|
||||
{"role": "user", "content": prompt},
|
||||
] if system else [
|
||||
{"role": "user", "content": prompt},
|
||||
],
|
||||
"response_format": schema,
|
||||
|
||||
Reference in New Issue
Block a user