From b8571b9af38036caab10157e39860d4d50074cf1 Mon Sep 17 00:00:00 2001 From: Jacob Emmerson <84752408+jacobemmerson@users.noreply.github.com> Date: Sat, 18 Apr 2026 13:59:57 -0400 Subject: [PATCH] add: litellm support --- cais/config.py | 5 ++- examples/rct_regression.ipynb | 60 +++++++++++++++++++++++------------ requirements.txt | 3 +- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/cais/config.py b/cais/config.py index 5c0a6a8..a589f19 100644 --- a/cais/config.py +++ b/cais/config.py @@ -11,8 +11,8 @@ from langchain_google_genai import ChatGoogleGenerativeAI from dotenv import load_dotenv from langchain_deepseek import ChatDeepSeek - from langchain_together import ChatTogether +from langchain_litellm import ChatLiteLLM logger = logging.getLogger(__name__) @@ -82,6 +82,9 @@ def get_llm_client(provider: Optional[str] = None, model_name: Optional[str] = N if not api_key: raise ValueError("OPENROUTER_API_KEY not found in environment.") return ChatOpenAI(model=model_name, base_url="https://openrouter.ai/api/v1", api_key=api_key, **kwargs) + + elif provider == 'litellm': + return ChatLiteLLM(model=model_name, **kwargs) # Example for Ollama (ensure langchain_community is installed) # elif provider == "ollama": diff --git a/examples/rct_regression.ipynb b/examples/rct_regression.ipynb index aec6edc..1c69162 100644 --- a/examples/rct_regression.ipynb +++ b/examples/rct_regression.ipynb @@ -14,6 +14,16 @@ "id": "854a4bea", "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/tae/anaconda3/envs/cais/lib/python3.10/site-packages/google/api_core/_python_version_support.py:263: FutureWarning: You are using a Python version (3.10.20) which Google will stop supporting in new releases of google.api_core once it reaches its end of life (2026-10-04). Please upgrade to the latest Python version, or at least Python 3.11, to continue receiving updates for google.api_core past that date.\n", + " warnings.warn(message, FutureWarning)\n", + "/Users/tae/anaconda3/envs/cais/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from .autonotebook import tqdm as notebook_tqdm\n" + ] + }, { "name": "stdout", "output_type": "stream", @@ -70,7 +80,7 @@ " dataset_path = data_dir + data_file,\n", " dataset_description = description,\n", " model_name = 'gpt-4o-mini',\n", - " provider = 'openai'\n", + " provider = 'litellm'\n", ") # construct agent" ] }, @@ -81,18 +91,26 @@ "metadata": {}, "outputs": [ { - "name": "stdout", + "name": "stderr", "output_type": "stream", "text": [ - "Interpreting query with hybrid approach...\n", - "Identified Confounders: ['citizen', 'religious', 'experience', 'skilledjob', 'woman', 'time']\n" + "\u001b[92m13:57:09 - LiteLLM:INFO\u001b[0m: utils.py:4011 - \n", + "LiteLLM completion() model= gpt-4o-mini; provider = openai\n", + "\u001b[92m13:57:11 - LiteLLM:INFO\u001b[0m: utils.py:1653 - Wrapper: Completed Call, calling success_handler\n", + "\u001b[92m13:57:11 - LiteLLM:INFO\u001b[0m: utils.py:4011 - \n", + "LiteLLM completion() model= gpt-4o-mini; provider = openai\n", + "\u001b[92m13:57:13 - LiteLLM:INFO\u001b[0m: utils.py:1653 - Wrapper: Completed Call, calling success_handler\n", + "\u001b[92m13:57:13 - LiteLLM:INFO\u001b[0m: utils.py:4011 - \n", + "LiteLLM completion() model= gpt-4o-mini; provider = openai\n", + "\u001b[92m13:57:17 - LiteLLM:INFO\u001b[0m: utils.py:1653 - Wrapper: Completed Call, calling success_handler\n" ] }, { - "name": "stderr", + "name": "stdout", "output_type": "stream", "text": [ - "LLM reference level '0' not in sampled values for 'immigrant'.\n" + "Interpreting query with hybrid approach...\n", + "Identified Confounders: ['citizen', 'religious', 'experience', 'skilledjob', 'woman', 'time']\n" ] } ], @@ -180,7 +198,7 @@ { "data": { "text/plain": [ - "'/Users/tae/Work/zhijing/CauSciBench/data/real_data/vernby_2019_cleaned_99384.csv'" + "'/Users/tae/Work/zhijing/CauSciBench/data/real_data/vernby_2019_cleaned_25604.csv'" ] }, "execution_count": 7, @@ -202,29 +220,29 @@ "name": "stdout", "output_type": "stream", "text": [ - "effect_estimates_by_level: {'treatment_effect': {'estimate': np.float64(-0.08611704628931967), 'p_value': np.float64(0.0005900321757260882), 'conf_int': [-0.13517178151694775, -0.037062311061691576], 'std_err': np.float64(0.02500797293228001)}}\n", - "LLM interpretation raw output: The analysis indicates that being an immigrant is associated with a decrease in the likelihood of receiving an interview request, with an estimated effect of -0.086 (SE = 0.025), and a 95% confidence interval of [-0.135, -0.037]. This effect is statistically significant (p < 0.001), suggesting that immigrants are indeed less likely to be invited for interviews compared to non-immigrants. The use of linear regression is plausible given the randomized controlled trial design, which minimizes confounding and allows for precise estimation of the treatment effect. This method is appropriate as it controls for various covariates that could influence the outcome, while alternatives like observational studies would be less suitable due to potential unmeasured confounding. However, key threats to identification validity include the assumptions of linearity and homoscedasticity, which, if violated, could affect the reliability of the estimates. Additionally, while the RCT design reduces confounding, the generalizability of the findings may be limited to the specific context of the study.\n" + "effect_estimates_by_level: {'treatment_effect': {'estimate': np.float64(-0.08611704628932033), 'p_value': np.float64(0.0005900321757261033), 'conf_int': [-0.13517178151694892, -0.03706231106169176], 'std_err': np.float64(0.025007972932280253)}}\n", + "LLM interpretation raw output: The analysis indicates that being an immigrant is associated with a decrease in the likelihood of receiving an interview request, with an estimated effect of -0.086 (SE = 0.025), and a 95% confidence interval of [-0.135, -0.037]. This effect is statistically significant (p < 0.001), suggesting that immigrants are indeed less likely to be invited for interviews compared to non-immigrants. The use of linear regression is plausible given the randomized controlled trial design, which minimizes bias and allows for the control of confounding variables. This method is appropriate as it effectively estimates the treatment effect while accounting for relevant covariates, whereas alternative methods may not adequately address potential confounding. However, key threats to identification validity include the assumption of a linear relationship and the potential for unmeasured confounders, which could affect the robustness of the results. Limitations include the specific context of the study, which may not generalize to all job markets or immigrant populations.\n" ] }, { "data": { "text/plain": [ - "{'results': {'effect_estimate': np.float64(-0.08611704628931967),\n", - " 'p_value': np.float64(0.0005900321757260882),\n", - " 'confidence_interval': [-0.13517178151694775, -0.037062311061691576],\n", - " 'standard_error': np.float64(0.02500797293228001),\n", + "{'results': {'effect_estimate': np.float64(-0.08611704628932033),\n", + " 'p_value': np.float64(0.0005900321757261033),\n", + " 'confidence_interval': [-0.13517178151694892, -0.03706231106169176],\n", + " 'standard_error': np.float64(0.025007972932280253),\n", " 'estimated_effects_by_level': None,\n", " 'reference_level_used': None,\n", " 'formula': 'invited ~ immigrant + citizen + religious + experience + skilledjob + woman + time',\n", - " 'model_summary_text': ' OLS Regression Results \\n==============================================================================\\nDep. Variable: invited R-squared: 0.069\\nModel: OLS Adj. R-squared: 0.065\\nMethod: Least Squares F-statistic: 15.83\\nDate: Tue, 31 Mar 2026 Prob (F-statistic): 3.72e-20\\nTime: 16:43:56 Log-Likelihood: -396.79\\nNo. Observations: 1492 AIC: 809.6\\nDf Residuals: 1484 BIC: 852.0\\nDf Model: 7 \\nCovariance Type: nonrobust \\n==============================================================================\\n coef std err t P>|t| [0.025 0.975]\\n------------------------------------------------------------------------------\\nIntercept -0.0044 0.036 -0.122 0.903 -0.075 0.066\\nimmigrant -0.0861 0.025 -3.444 0.001 -0.135 -0.037\\ncitizen 0.0169 0.018 0.954 0.340 -0.018 0.052\\nreligious -0.0058 0.016 -0.356 0.722 -0.038 0.026\\nexperience 0.0288 0.019 1.484 0.138 -0.009 0.067\\nskilledjob 0.0366 0.023 1.624 0.105 -0.008 0.081\\nwoman 0.0804 0.016 4.897 0.000 0.048 0.113\\ntime 1.0615 0.144 7.351 0.000 0.778 1.345\\n==============================================================================\\nOmnibus: 572.245 Durbin-Watson: 2.029\\nProb(Omnibus): 0.000 Jarque-Bera (JB): 1598.335\\nSkew: 2.070 Prob(JB): 0.00\\nKurtosis: 5.927 Cond. No. 30.8\\n==============================================================================\\n\\nNotes:\\n[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.',\n", + " 'model_summary_text': ' OLS Regression Results \\n==============================================================================\\nDep. Variable: invited R-squared: 0.069\\nModel: OLS Adj. R-squared: 0.065\\nMethod: Least Squares F-statistic: 15.83\\nDate: Sat, 18 Apr 2026 Prob (F-statistic): 3.72e-20\\nTime: 13:59:29 Log-Likelihood: -396.79\\nNo. Observations: 1492 AIC: 809.6\\nDf Residuals: 1484 BIC: 852.0\\nDf Model: 7 \\nCovariance Type: nonrobust \\n==============================================================================\\n coef std err t P>|t| [0.025 0.975]\\n------------------------------------------------------------------------------\\nIntercept -0.0044 0.036 -0.122 0.903 -0.075 0.066\\nimmigrant -0.0861 0.025 -3.444 0.001 -0.135 -0.037\\ncitizen 0.0169 0.018 0.954 0.340 -0.018 0.052\\nreligious -0.0058 0.016 -0.356 0.722 -0.038 0.026\\nexperience 0.0288 0.019 1.484 0.138 -0.009 0.067\\nskilledjob 0.0366 0.023 1.624 0.105 -0.008 0.081\\nwoman 0.0804 0.016 4.897 0.000 0.048 0.113\\ntime 1.0615 0.144 7.351 0.000 0.778 1.345\\n==============================================================================\\nOmnibus: 572.245 Durbin-Watson: 2.029\\nProb(Omnibus): 0.000 Jarque-Bera (JB): 1598.335\\nSkew: 2.070 Prob(JB): 0.00\\nKurtosis: 5.927 Cond. No. 30.8\\n==============================================================================\\n\\nNotes:\\n[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.',\n", " 'diagnostics': {},\n", " 'interpretation_details': {},\n", " 'interpretation': 'Interpretation not available.',\n", " 'method_used': 'linear_regression',\n", " 'model_name': 'gpt-4o-mini',\n", - " 'provider': 'openai'},\n", + " 'provider': 'litellm'},\n", " 'explanation': {'final_explanation_text': '**Method Used:** Linear Regression\\n\\n**Method Explanation:**\\nThe linear_regression method is a causal inference technique used to estimate causal effects from observational data.\\n\\n**Results:**\\n- Estimated Causal Effect: -0.0861\\n- 95% Confidence Interval: [-0.1352, -0.0371]\\n- P-value: 0.0006\\n\\n**Interpretation Guide:**\\nThe estimated effect represents the causal impact of immigrant on invited, given the assumptions of the method are met. Careful consideration of these assumptions is needed for valid causal interpretation.\\n\\n**Assumptions:**\\n- linear relationship between treatment, covariates, and outcome: This is a key assumption for the selected causal inference method.\\n- no unmeasured confounders (if observational): This is a key assumption for the selected causal inference method.\\n- correct model specification: This is a key assumption for the selected causal inference method.\\n- homoscedasticity of errors: This is a key assumption for the selected causal inference method.\\n- normally distributed errors (for inference): This is a key assumption for the selected causal inference method.\\n\\n**Limitations:**\\nThe linear_regression method has general limitations in terms of its assumptions and applicability.\\n\\n',\n", - " 'interpretation_text': 'The analysis indicates that being an immigrant is associated with a decrease in the likelihood of receiving an interview request, with an estimated effect of -0.086 (SE = 0.025), and a 95% confidence interval of [-0.135, -0.037]. This effect is statistically significant (p < 0.001), suggesting that immigrants are indeed less likely to be invited for interviews compared to non-immigrants. The use of linear regression is plausible given the randomized controlled trial design, which minimizes confounding and allows for precise estimation of the treatment effect. This method is appropriate as it controls for various covariates that could influence the outcome, while alternatives like observational studies would be less suitable due to potential unmeasured confounding. However, key threats to identification validity include the assumptions of linearity and homoscedasticity, which, if violated, could affect the reliability of the estimates. Additionally, while the RCT design reduces confounding, the generalizability of the findings may be limited to the specific context of the study.'}}" + " 'interpretation_text': 'The analysis indicates that being an immigrant is associated with a decrease in the likelihood of receiving an interview request, with an estimated effect of -0.086 (SE = 0.025), and a 95% confidence interval of [-0.135, -0.037]. This effect is statistically significant (p < 0.001), suggesting that immigrants are indeed less likely to be invited for interviews compared to non-immigrants. The use of linear regression is plausible given the randomized controlled trial design, which minimizes bias and allows for the control of confounding variables. This method is appropriate as it effectively estimates the treatment effect while accounting for relevant covariates, whereas alternative methods may not adequately address potential confounding. However, key threats to identification validity include the assumption of a linear relationship and the potential for unmeasured confounders, which could affect the robustness of the results. Limitations include the specific context of the study, which may not generalize to all job markets or immigrant populations.'}}" ] }, "execution_count": 8, @@ -244,12 +262,12 @@ "outputs": [ { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPAAAAAQCAYAAAAoEfIQAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjEsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvc2/+5QAAAAlwSFlzAAASdAA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fF7k2mImL2yRd7MTHvnbJ8rTRieXzrRZsumLLffZ2rWl5u1e5nMTDsoiS8l1exRrkAZI6R/bSXVs6aPsu7nPVyas25F8XteQl6Rifmtpkw1xQ4bJviIiVDXV5laQH7dLe77ZJXz6bFRHFfE3i8EyISbrOHkP2tZtPyu3p8TL7TUNe6uqkFl2tnoX2ipP1qpUmcolrdxnoz6gwntb6cqH8cB9PW+cYaYmL5Jn4OSwizqwYJxNDr3Smc5J3lkO80xwYEcVjcR1MLSRKctfBwu08m9OwffGQxUE9klcDy2wQDCCvTm02//Fikcsi5WtuC7q8yCWtrIosdmkrF73JEfGTClaudoiwq8tVJ/goZCai0iqnRMS6Fnipq5NadE0Y/3fCcYyDxyz+D73mIcy1yAAlAAAAAElFTkSuQmCC", "text/latex": [ - "$\\displaystyle -0.0861170462893197$" + "$\\displaystyle -0.0861170462893203$" ], "text/plain": [ - "np.float64(-0.08611704628931967)" + "np.float64(-0.08611704628932033)" ] }, "execution_count": 9, @@ -341,7 +359,7 @@ { "data": { "text/markdown": [ - "The analysis indicates that being an immigrant is associated with a decrease in the likelihood of receiving an interview request, with an estimated effect of -0.086 (SE = 0.025), and a 95% confidence interval of [-0.135, -0.037]. This effect is statistically significant (p < 0.001), suggesting that immigrants are indeed less likely to be invited for interviews compared to non-immigrants. The use of linear regression is plausible given the randomized controlled trial design, which minimizes confounding and allows for precise estimation of the treatment effect. This method is appropriate as it controls for various covariates that could influence the outcome, while alternatives like observational studies would be less suitable due to potential unmeasured confounding. However, key threats to identification validity include the assumptions of linearity and homoscedasticity, which, if violated, could affect the reliability of the estimates. Additionally, while the RCT design reduces confounding, the generalizability of the findings may be limited to the specific context of the study." + "The analysis indicates that being an immigrant is associated with a decrease in the likelihood of receiving an interview request, with an estimated effect of -0.086 (SE = 0.025), and a 95% confidence interval of [-0.135, -0.037]. This effect is statistically significant (p < 0.001), suggesting that immigrants are indeed less likely to be invited for interviews compared to non-immigrants. The use of linear regression is plausible given the randomized controlled trial design, which minimizes bias and allows for the control of confounding variables. This method is appropriate as it effectively estimates the treatment effect while accounting for relevant covariates, whereas alternative methods may not adequately address potential confounding. However, key threats to identification validity include the assumption of a linear relationship and the potential for unmeasured confounders, which could affect the robustness of the results. Limitations include the specific context of the study, which may not generalize to all job markets or immigrant populations." ], "text/plain": [ "" @@ -383,7 +401,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.18" + "version": "3.10.20" } }, "nbformat": 4, diff --git a/requirements.txt b/requirements.txt index 72e789c..27c8b78 100644 --- a/requirements.txt +++ b/requirements.txt @@ -51,4 +51,5 @@ matplotlib==3.10.1 langchain==0.3.26 rddensity rdd - +litellm +langchain-litellm \ No newline at end of file