-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add streamlit demo for all deployable agents #85
Conversation
WalkthroughThe recent updates aim to enhance the prediction market agent software by improving functionality and reliability. Changes include enhanced logging, better error handling, and the integration of API keys for secure interactions with external services. A significant addition is the Streamlit app, providing a user-friendly interface for simulating agent behaviors in prediction markets. These updates streamline operations and enhance the overall user experience. Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files skipped from review as they are similar to previous changes (1)
Additional comments not posted (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
# Assume very high probability markets are already known, and have | ||
# been correctly bet on, and therefore the value of betting on them | ||
# is low. | ||
if market_is_saturated(market=market): | ||
logger.info( | ||
f"Skipping market {market.id=} {market.question=}, because it is already saturated." | ||
f"Skipping market {market.url} with the question '{market.question}', because it is already saturated." |
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.
Just trying to make log messages more human friendly
@@ -17,7 +17,8 @@ | |||
|
|||
|
|||
class DeployableKnownOutcomeAgent(DeployableAgent): | |||
model = "gpt-4-turbo-preview" | |||
model = "gpt-4-1106-preview" |
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.
Needed to change this, see the summarize_if_required
function below. Lmk if I did wrong 🙈
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.
oops, my bad!
|
||
|
||
@st.cache_resource | ||
def add_sink_to_logger() -> None: |
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.
If we call this at the top of streamlit application, any logged messages will show in Streamlit
@@ -0,0 +1,100 @@ | |||
""" |
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.
The idea is similar to the one in the EVO repository, but here, I used the DeployableAgent class instead of benchmark ones.
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.
Actionable comments posted: 2
llm = ChatOpenAI( | ||
temperature=0, | ||
model="gpt-3.5-turbo-0125", | ||
api_key=APIKeys().openai_api_key.get_secret_value(), |
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.
Tip
Codebase Verification
The search results from the rg
command provide numerous instances where the APIKeys
class is used across various files in the codebase. However, none of these instances include comments or documentation specifically addressing the thread safety of the APIKeys
class or its methods, such as get_secret_value()
.
Given the absence of explicit information on thread safety in the provided context, and considering the typical concerns around thread safety in scenarios involving shared resources (like API keys), it's prudent to recommend further investigation or implementation of thread safety mechanisms if the _summary
method is indeed expected to be called concurrently.
Conclusion
The review comment concerning the thread safety of APIKeys().openai_api_key.get_secret_value()
in a concurrent environment stands as a valid concern due to the lack of explicit thread safety guarantees in the provided code snippets and usage contexts. It is advisable to ensure that appropriate thread safety measures are implemented if concurrent access is expected.
Analysis chain
Ensure that APIKeys().openai_api_key.get_secret_value()
is thread-safe if _summary
is expected to be called concurrently.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any documentation or comments in the codebase regarding thread safety of APIKeys class.
rg "APIKeys" --context 5
Length of output: 31018
""" | ||
PYTHONPATH=. streamlit run scripts/agent_app.py | ||
|
||
Tip: if you specify PYTHONPATH=., streamlit will watch for the changes in all files, isntead of just this one. |
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.
Correct the typo in "instead" in the tip comment.
- isntead
+ instead
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
Tip: if you specify PYTHONPATH=., streamlit will watch for the changes in all files, isntead of just this one. | |
Tip: if you specify PYTHONPATH=., streamlit will watch for the changes in all files, instead of just this one. |
Summary by CodeRabbit
New Features
Refactor
Documentation