Conversation
| return remove_thinking_tags(response_content) | ||
| else: | ||
| return response_content | ||
|
|
There was a problem hiding this comment.
maybe merge two functions like this:
def generate(self, messages: MessageList, **kwargs) -> str:
"""Generate a response from OpenAI LLM, optionally overriding generation params."""
temperature = kwargs.get("temperature", self.config.temperature)
max_tokens = kwargs.get("max_tokens", self.config.max_tokens)
top_p = kwargs.get("top_p", self.config.top_p)
response = self.client.chat.completions.create(
model=self.config.model_name_or_path,
messages=messages,
extra_body=self.config.extra_body,
temperature=temperature,
max_tokens=max_tokens,
top_p=top_p,
)
logger.info(f"Response from OpenAI: {response.model_dump_json()}")
response_content = response.choices[0].message.content
if self.config.remove_think_prefix:
return remove_thinking_tags(response_content)
return response_content
| return zh + max(1, rest // 4) | ||
|
|
||
|
|
||
| class StrategyStructMemReader(SimpleStructMemReader, ABC): |
There was a problem hiding this comment.
I noticed there’s quite a bit of overlap between StrategyStructMemReader and SimpleStructMemReader — particularly in the shared logic for parsing and memory generation.
Would it make sense to consolidate them or refactor into a shared base class for clarity and easier maintenance?
There was a problem hiding this comment.
def find_project_root(marker=".git"):
"""Find the project root directory by marking the file"""
current = Path(file).resolve()
while current != current.parent:
if (current / marker).exists():
return current
current = current.parent
logger.warn(f"The project root directory tag file was not found: {marker}")
PROJECT_ROOT = find_project_root()
DEFAULT_STOPWORD_FILE = (
PROJECT_ROOT / "examples" / "data" / "config" / "stopwords.txt"
) # cause time delay
maybe at product env will not exist this path "examples" / "data" / "config" / "stopwords.txt"
Description
Summary: (summary)
Fix: #(issue)
Docs Issue/PR: (docs-issue-or-pr-link)
Reviewer: @(reviewer)
Checklist: