guidance-ai / guidance

A guidance language for controlling large language models.
MIT License
18.62k stars 1.03k forks source link

MSALOpenAI doesn't work #197

Open yanivnaor opened 1 year ago

yanivnaor commented 1 year ago

The bug Error when trying to instantiate the MSALOpenAI class: AttributeError: 'MSALOpenAI' object has no attribute '_rest_headers'

To Reproduce

guidance.llm = guidance.llms.MSALOpenAI(model="dev-text-davinci-003", authority="SOME_AUTHORITY", endpoint="SOME_ENDPOINT", scopes=["api://SOME_GUID/access"], client_id="SOME_CLIENT_ID")

The bug seems to be the super().init() call in MSALOpenAI is missing the argument rest_call=True. rest_call defaults to False, which means self._rest_headers is None, which causes the error.

System info (please complete the following information):

yanivnaor commented 1 year ago

There are more related bugs in _rest_call() func itself. for example, self.endpoint no longer exists and self.token is never called anymore