-
Notifications
You must be signed in to change notification settings - Fork 5
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
Unify variable name and use gpt-4o for cheaper runs #556
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -297,10 +297,10 @@ class DeployablePredictionAgent(DeployableAgent): | |
def __init__( | ||
self, | ||
enable_langfuse: bool = APIKeys().default_enable_langfuse, | ||
store_prediction: bool = True, | ||
store_predictions: bool = True, | ||
) -> None: | ||
super().__init__(enable_langfuse=enable_langfuse) | ||
self.store_prediction = store_prediction | ||
self.store_predictions = store_predictions | ||
|
||
def initialize_langfuse(self) -> None: | ||
super().initialize_langfuse() | ||
|
@@ -443,13 +443,13 @@ def after_process_market( | |
processed_market: ProcessedMarket | None, | ||
) -> None: | ||
keys = APIKeys() | ||
if self.store_prediction: | ||
if self.store_predictions: | ||
market.store_prediction( | ||
processed_market=processed_market, keys=keys, agent_name=self.agent_name | ||
) | ||
else: | ||
logger.info( | ||
f"Prediction {processed_market} not stored because {self.store_prediction=}." | ||
f"Prediction {processed_market} not stored because {self.store_predictions=}." | ||
Comment on lines
+458
to
+464
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix inconsistent method name While the parameter has been renamed to - market.store_prediction(
+ market.store_predictions(
processed_market=processed_market, keys=keys, agent_name=self.agent_name
)
|
||
) | ||
|
||
def before_process_markets(self, market_type: MarketType) -> None: | ||
|
@@ -508,12 +508,12 @@ class DeployableTraderAgent(DeployablePredictionAgent): | |
def __init__( | ||
self, | ||
enable_langfuse: bool = APIKeys().default_enable_langfuse, | ||
store_prediction: bool = True, | ||
store_predictions: bool = True, | ||
store_trades: bool = True, | ||
place_trades: bool = True, | ||
) -> None: | ||
super().__init__( | ||
enable_langfuse=enable_langfuse, store_prediction=store_prediction | ||
enable_langfuse=enable_langfuse, store_predictions=store_predictions | ||
) | ||
self.store_trades = store_trades | ||
self.place_trades = place_trades | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ def rewrite_question_into_image_generation_prompt(question: str) -> str: | |
"openai not installed, please install extras `langchain` to use this function." | ||
) | ||
llm = ChatOpenAI( | ||
model="gpt-4-turbo", | ||
model="gpt-4o-2024-08-06", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Non-standard GPT model names require standardization across multiple files The codebase contains several instances of non-standard OpenAI model names that need to be updated:
These non-standard model names will cause runtime errors as they don't match OpenAI's official model naming convention. Update all instances to use standard OpenAI model names like 🔗 Analysis chainInvalid OpenAI model name detected The model name "gpt-4o-2024-08-06" appears to be non-standard and will likely cause runtime errors. OpenAI's official model names don't follow this format. Apply this fix: - model="gpt-4o-2024-08-06",
+ model="gpt-4-1106-preview", # Latest GPT-4 Turbo model Let's verify if this non-standard model name is used elsewhere: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Search for similar non-standard model names across the codebase
# Expected: No other occurrences of this pattern should exist
echo "Searching for non-standard gpt-4o model names:"
rg -l "gpt-4o-[0-9]{4}-[0-9]{2}-[0-9]{2}"
echo -e "\nSearching for all GPT-4 model references for comparison:"
rg -l "gpt-4"
Length of output: 834 Script: #!/bin/bash
# Let's check the actual model names used in these files
echo "Checking model names in is_predictable.py:"
rg "model\s*=.*gpt-4" prediction_market_agent_tooling/tools/is_predictable.py -A 1
echo -e "\nChecking model names in is_invalid.py:"
rg "model\s*=.*gpt-4" prediction_market_agent_tooling/tools/is_invalid.py -A 1
echo -e "\nChecking model names in relevant_news_analysis.py:"
rg "model\s*=.*gpt-4" prediction_market_agent_tooling/tools/relevant_news_analysis/relevant_news_analysis.py -A 1
echo -e "\nChecking model names in utils.py:"
rg "model\s*=.*gpt-4" prediction_market_agent_tooling/tools/utils.py -A 1
echo -e "\nChecking model names in benchmark/utils.py:"
rg "model\s*=.*gpt-4" prediction_market_agent_tooling/benchmark/utils.py -A 1
Length of output: 1048 Script: #!/bin/bash
# Let's check for any model variable assignments or configurations
echo "Checking all model configurations in is_predictable.py:"
rg "model.*=.*" prediction_market_agent_tooling/tools/is_predictable.py
echo -e "\nChecking all model configurations in is_invalid.py:"
rg "model.*=.*" prediction_market_agent_tooling/tools/is_invalid.py
echo -e "\nChecking for any model configurations in utils.py:"
rg "model.*=.*" prediction_market_agent_tooling/tools/utils.py
echo -e "\nChecking for any model configurations in benchmark/utils.py:"
rg "model.*=.*" prediction_market_agent_tooling/benchmark/utils.py
# Let's also check for any configuration files that might define these models
echo -e "\nChecking for potential config files:"
fd -e yaml -e json -e toml -e ini
Length of output: 2114 Script: #!/bin/bash
# Let's check the content of pyproject.toml for any model configurations
echo "Checking pyproject.toml for model configurations:"
cat pyproject.toml
# Let's also check if there's an 'engine' variable defined that might be setting these models
echo -e "\nChecking for engine variable definitions:"
rg "engine\s*=.*gpt" -A 2
Length of output: 2302 |
||
temperature=0.0, | ||
api_key=APIKeys().openai_api_key_secretstr_v1, | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,10 @@ | |
get_langfuse_langchain_config, | ||
observe, | ||
) | ||
from prediction_market_agent_tooling.tools.utils import LLM_SUPER_LOW_TEMPERATURE | ||
from prediction_market_agent_tooling.tools.utils import ( | ||
LLM_SEED, | ||
LLM_SUPER_LOW_TEMPERATURE, | ||
) | ||
|
||
# I tried to make it return a JSON, but it didn't work well in combo with asking it to do chain of thought. | ||
QUESTION_IS_PREDICTABLE_BINARY_PROMPT = """Main signs about a fully qualified question (sometimes referred to as a "market"): | ||
|
@@ -81,7 +84,7 @@ | |
@db_cache | ||
def is_predictable_binary( | ||
question: str, | ||
engine: str = "gpt-4-1106-preview", | ||
engine: str = "gpt-4o-2024-08-06", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Invalid model identifier detected The model identifier "gpt-4o-2024-08-06" appears to be non-standard and likely incorrect:
The previous model "gpt-4-1106-preview" should be retained or updated to a currently available OpenAI model. 🔗 Analysis chainVerify the availability and compatibility of the new model version The model has been changed from "gpt-4-1106-preview" to "gpt-4o-2024-08-06". Let's verify:
Also applies to: 125-125 Let me gather more information about model validation and configuration in the codebase. Let me try one more search to find any model-related configurations or imports. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Search for model version references and verify consistency
# Check for any documentation or configuration files that might list valid models
fd -t f -e md -e yaml -e json . | xargs rg -l "gpt-4o-2024-08-06"
# Check if there are any model-specific configurations or tests
rg -A 5 "gpt-4o-2024-08-06"
# Look for any model validation logic
ast-grep --pattern 'if $model == "gpt-4o-2024-08-06" { $$$ }'
Length of output: 2379 Script: #!/bin/bash
# Check for model validation or configuration logic
rg -l "SUPPORTED_MODELS|ALLOWED_MODELS|MODEL_CONFIG" .
# Look for any model-related constants or configurations
ast-grep --pattern 'MODEL = $value'
ast-grep --pattern 'MODELS = $value'
# Check for any OpenAI client initialization or model validation
rg -A 5 "openai\..*Client"
Length of output: 162 Script: #!/bin/bash
# Search for OpenAI imports and configurations
rg -l "from openai|import openai"
# Look for any model-related constants
rg "DEFAULT_MODEL|GPT_|MODEL_NAME"
# Check configuration files
fd -t f "config|settings" -e py -e yaml -e json | xargs cat
Length of output: 8456 |
||
prompt_template: str = QUESTION_IS_PREDICTABLE_BINARY_PROMPT, | ||
max_tokens: int = 1024, | ||
) -> bool: | ||
|
@@ -98,6 +101,7 @@ def is_predictable_binary( | |
llm = ChatOpenAI( | ||
model=engine, | ||
temperature=LLM_SUPER_LOW_TEMPERATURE, | ||
seed=LLM_SEED, | ||
api_key=APIKeys().openai_api_key_secretstr_v1, | ||
) | ||
|
||
|
@@ -118,7 +122,7 @@ def is_predictable_binary( | |
def is_predictable_without_description( | ||
question: str, | ||
description: str, | ||
engine: str = "gpt-4-1106-preview", | ||
engine: str = "gpt-4o-2024-08-06", | ||
prompt_template: str = QUESTION_IS_PREDICTABLE_WITHOUT_DESCRIPTION_PROMPT, | ||
max_tokens: int = 1024, | ||
) -> bool: | ||
|
@@ -137,6 +141,7 @@ def is_predictable_without_description( | |
llm = ChatOpenAI( | ||
model=engine, | ||
temperature=LLM_SUPER_LOW_TEMPERATURE, | ||
seed=LLM_SEED, | ||
api_key=APIKeys().openai_api_key_secretstr_v1, | ||
) | ||
|
||
|
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.
💡 Codebase verification
Update required: Rename
store_prediction
method across market classesThe parameter rename from
store_prediction
tostore_predictions
inDeployablePredictionAgent
is incomplete. Additional changes are needed:store_prediction
method needs to be renamed tostore_predictions
in:AgentMarket
base class (agent_market.py
)MetaculusAgentMarket
class (metaculus.py
)OmenAgentMarket
class (omen.py
)scripts/store_prediction.py
should be renamed tostore_predictions.py
This ensures consistent naming throughout the codebase, as the functionality deals with storing multiple predictions.
🔗 Analysis chain
Verify parameter rename impact across the codebase
The rename from
store_prediction
tostore_predictions
improves naming consistency. However, based on past reviews, there are several places that still usestore_prediction
(singular) that need to be updated:Let me check the specific occurrences of
store_prediction
to verify if they are related to the parameter rename.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 326
Script:
Length of output: 2355