fix/various fixes
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import json
|
||||
from app.core.logging import get_logger
|
||||
import re
|
||||
from typing import Any, Optional
|
||||
|
||||
from app.core.langchain_llm import bind_json_object_mode
|
||||
from app.core.logging import get_logger
|
||||
|
||||
from .json_payload import extract_json_payload
|
||||
from .settings import MemoirImageSettings
|
||||
|
||||
@@ -59,10 +61,7 @@ class MemoirImagePromptService:
|
||||
if self.llm:
|
||||
raw_response = None
|
||||
try:
|
||||
json_llm = self.llm.bind(
|
||||
model_kwargs={"response_format": {"type": "json_object"}},
|
||||
max_tokens=512,
|
||||
)
|
||||
json_llm = bind_json_object_mode(self.llm, max_tokens=512)
|
||||
response = json_llm.invoke(
|
||||
"Return JSON only with keys prompt, style, size. "
|
||||
"Convert the memoir scene into an image-generation prompt.\n"
|
||||
@@ -123,10 +122,7 @@ class MemoirImagePromptService:
|
||||
|
||||
if self.llm:
|
||||
try:
|
||||
json_llm = self.llm.bind(
|
||||
model_kwargs={"response_format": {"type": "json_object"}},
|
||||
max_tokens=512,
|
||||
)
|
||||
json_llm = bind_json_object_mode(self.llm, max_tokens=512)
|
||||
response = json_llm.invoke(
|
||||
"Return JSON only with keys prompt, style, size. "
|
||||
"Create an image-generation prompt for a memoir chapter COVER. "
|
||||
|
||||
Reference in New Issue
Block a user