csinva / imodelsX

Scikit-learn friendly library to interpret, and prompt-engineer text datasets using large language models.
https://csinva.io/imodelsX/
MIT License
161 stars 26 forks source link

name 'openai' is not defined #7

Closed clclclaiggg closed 6 months ago

clclclaiggg commented 1 year ago

Hello, I am using the code: import numpy as np from imodelsx import explain_module_sasc

a toy module that responds to the length of a string

mod = lambda str_list: np.array([len(s) for s in str_list])

a toy dataset where the longest strings are animals

text_str_list = ["red", "blue", "x", "1", "2", "hippopotamus", "elephant", "rhinoceros"] explanation_dict = explain_module_sasc( text_str_list, mod, ngrams=1, ) print(explanation_dict) Errors will be encountered: name 'openai' is not defined How to solve this problem. thank you.

csinva commented 6 months ago

You'll need to install the openai package for this pip install openai