Skip to content

Adding general guidance ai model support #66

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

Merged
merged 1 commit into from
Jul 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pywhyllm/suggesters/identification_suggester.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ class IdentificationSuggester(IdentifierProtocol):

def __init__(self, llm=None):
if llm is not None:
if (llm == 'gpt-4'):
if llm == 'gpt-4':
self.llm = guidance.models.OpenAI('gpt-4')
self.model_suggester = ModelSuggester('gpt-4')
elif isinstance(llm, guidance.models.Model):
self.llm = llm
self.model_suggester = ModelSuggester(llm)
else:
raise ValueError("llm must be either 'gpt-4' or a guidance model instance.")

# def suggest_estimand(
# self,
Expand Down
6 changes: 5 additions & 1 deletion pywhyllm/suggesters/model_suggester.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ class ModelSuggester(ModelerProtocol):

def __init__(self, llm=None):
if llm is not None:
if (llm == 'gpt-4'):
if llm == 'gpt-4':
self.llm = guidance.models.OpenAI('gpt-4')
elif isinstance(llm, guidance.models.Model):
self.llm = llm
else:
raise ValueError("llm must be either 'gpt-4' or a guidance model instance.")

def suggest_domain_expertises(
self,
Expand Down
6 changes: 5 additions & 1 deletion pywhyllm/suggesters/simple_identification_suggester.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ class SimpleIdentificationSuggester:

def __init__(self, llm=None):
if llm is not None:
if (llm == 'gpt-4'):
if llm == 'gpt-4':
self.llm = guidance.models.OpenAI('gpt-4')
elif isinstance(llm, guidance.models.Model):
self.llm = llm
else:
raise ValueError("llm must be either 'gpt-4' or a guidance model instance.")

def suggest_iv(self, factors, treatment, outcome):
lm = self.llm
Expand Down
6 changes: 5 additions & 1 deletion pywhyllm/suggesters/simple_model_suggester.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ class SimpleModelSuggester:

def __init__(self, llm=None):
if llm is not None:
if (llm == 'gpt-4'):
if llm == 'gpt-4':
self.llm = guidance.models.OpenAI('gpt-4')
elif isinstance(llm, guidance.models.Model):
self.llm = llm
else:
raise ValueError("llm must be either 'gpt-4' or a guidance model instance.")

# new ver
def suggest_pairwise_relationship(self, variable1: str, variable2: str):
Expand Down
4 changes: 4 additions & 0 deletions pywhyllm/suggesters/validation_suggester.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def __init__(self, llm=None):
if llm is not None:
if llm == 'gpt-4':
self.llm = guidance.models.OpenAI('gpt-4')
elif isinstance(llm, guidance.models.Model):
self.llm = llm
else:
raise ValueError("llm must be either 'gpt-4' or a guidance model instance.")

def suggest_negative_controls(
self,
Expand Down