PowerBIDataSet credential not working: field "credential" not yet prepared so type is still a ForwardRef, you might need to call PowerBIDataset.update_forward_refs() #27583
{
"name": "ConfigError",
"message": "field \"credential\" not yet prepared so type is still a ForwardRef, you might need to call PowerBIDataset.update_forward_refs().",
"stack": "---------------------------------------------------------------------------
ConfigError Traceback (most recent call last)
Cell In[30], line 7
1 fast_llm = ChatOpenAI(
2 temperature=0.5, max_tokens=1000, model_name=\"gpt-3.5-turbo\", verbose=True, api_key=OPEN_AI_API_KEY
3 )
4 smart_llm = ChatOpenAI(temperature=0, max_tokens=100, model_name=\"gpt-4\", verbose=True, api_key=OPEN_AI_API_KEY)
6 toolkit = PowerBIToolkit(
----> 7 powerbi=PowerBIDataset(
8 dataset_id=\"AdvWorksTest\",
9 table_names=[\"SalesLT SalesOrderHeader\", \"SalesLT SalesOrderDetail\"],
10 credential=DefaultAzureCredential(),
11 ),
12 llm=smart_llm,
13 )
15 agent_executor = create_pbi_agent(
16 llm=fast_llm,
17 toolkit=toolkit,
18 verbose=True,
19 )
File c:\\Users\\jerschi\\projects\\.conda\\Lib\\site-packages\\pydantic\\v1\\main.py:339, in BaseModel.__init__(__pydantic_self__, **data)
333 \"\"\"
334 Create a new model by parsing and validating input data from keyword arguments.
335
336 Raises ValidationError if the input data cannot be parsed to form a valid model.
337 \"\"\"
338 # Uses something other than `self` the first arg to allow \"self\" as a settable attribute
--> 339 values, fields_set, validation_error = validate_model(__pydantic_self__.__class__, data)
340 if validation_error:
341 raise validation_error
File c:\\Users\\jerschi\\projects\\.conda\\Lib\\site-packages\\pydantic\\v1\\main.py:1074, in validate_model(model, input_data, cls)
1071 if check_extra:
1072 names_used.add(field.name if using_name else field.alias)
-> 1074 v_, errors_ = field.validate(value, values, loc=field.alias, cls=cls_)
1075 if isinstance(errors_, ErrorWrapper):
1076 errors.append(errors_)
File c:\\Users\\jerschi\\projects\\.conda\\Lib\\site-packages\\pydantic\\v1\\fields.py:857, in ModelField.validate(self, v, values, loc, cls)
855 if self.type_.__class__ is ForwardRef:
856 assert cls is not None
--> 857 raise ConfigError(
858 f'field \"{self.name}\" not yet prepared so type is still a ForwardRef, '
859 f'you might need to call {cls.__name__}.update_forward_refs().'
860 )
862 errors: Optional['ErrorList']
863 if self.pre_validators:
ConfigError: field \"credential\" not yet prepared so type is still a ForwardRef, you might need to call PowerBIDataset.update_forward_refs()."
}
Description
Hello Team,
I'm trying to use the PowerBIToolkit to connect to my PowerBI report and prompt a llm. Unfortunately, I get the following error message:
"ConfigError: field "credential" not yet prepared so type is still a ForwardRef, you might need to call PowerBIDataset.update_forward_refs()."
This seems like a straightforward issue, me and a group of students from the University of Toronto are eager to help with LangChain, could my team look into this issue?
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
Hello Team,
I'm trying to use the PowerBIToolkit to connect to my PowerBI report and prompt a llm. Unfortunately, I get the following error message: "ConfigError: field "credential" not yet prepared so type is still a ForwardRef, you might need to call PowerBIDataset.update_forward_refs()."
A quick google search showed me that this was an issue before (https://github.com/langchain-ai/langchain/issues/9823 and https://github.com/langchain-ai/langchain/issues/4325) that has been resolved, but somehow reverted. The other issues are closed, so I opened a new one to get some attention on this.
There is a workaround that works locally, but I need a solution that works on an application level.
From what I found, the error lies in https://github.com/hwchase17/langchain/blob/master/langchain/utilities/powerbi.py (based on some comments and this https://github.com/Azure/azure-sdk-for-python/issues/30288)
Best, jerschi
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies