-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use auto gen seed when using LLM cache #441
Conversation
rdagent/core/utils.py
Outdated
results = [ | ||
pool.apply_async(_subprocess_wrapper(f, APIBackend.cache_seed_gen.get_next_seed()), args=args) | ||
pool.apply_async(_subprocess_wrapper, args=(f, random.randint(0, 10000), args)) # noqa: S311 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use get_next_seed;
We may use other random seed mechanism if we want to solve the confliction with random.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should we use # noqa: S311
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S311, i don't think we need this encryption requirements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use get_next_seed; We may use other random seed mechanism if we want to solve the confliction with random.
APIBackend cannot be called here because a circular import occurs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import it in the function to avoid circular import
rdagent/core/utils.py
Outdated
return random.randint(0, 10000) # noqa: S311 | ||
|
||
|
||
cache_seed_gen = CacheSeedGen() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use upper case and add more specific prefix.
For example LLM_CACHE_SEED_GEN
Description
By two configs in RD_AGENT_SETTINGS, you can control the behavior of returning answers to the same question when LLM caching is enabled.
- use_auto_chat_cache_seed_gen: bool = False
- init_chat_cache_seed: int = 42
Behavior
Under setting: use_chat_cache=True, dump_chat_cache=True;
Given one question: Q, ask LLM 2 times;
Responses list is: (R1 ≠ R2 ≠ R3 ≠ R4 ≠ R5)
Motivation and Context
How Has This Been Tested?
pytest test/oai/test_completion.py
under directory ofRD-Agent
.Screenshots of Test Results (if appropriate):
Types of changes
📚 Documentation preview 📚: https://RDAgent--441.org.readthedocs.build/en/441/