lamini-ai / lamini

Apache License 2.0
2.5k stars 155 forks source link

Error in Code Guru Walkthrough #20

Closed rghosh08 closed 12 months ago

rghosh08 commented 1 year ago

Hello,

I am trying to implement your code guru walkthrough (https://lamini-ai.github.io/Examples/code_guru/#define-the-llm-interface) and getting the following error. Could you please take a look?

Inptut question = Question(question='LLMEngine.save_data') function = Function( name='init', code='def init(self, builder, name):\n self.builder = builder\n self.name = name\n self.main = Function(program=self, name="main")\n self.functions = {"main": self.main}\n self.examples = []' ) llm.save_data([function]) answer = llm(input=Question(question=question), output_type=Answer)

print(answer)

Output Error

ValidationError Traceback (most recent call last) /home/ubuntu/lamini/main.ipynb Cell 20 line 7 2](vscode-notebook-cell://ssh-remote%2B10.112.30.123/home/ubuntu/lamini/main.ipynb#X25sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1'%3E2%3C/a%3E) function = Function( 3](vscode-notebook-cell://ssh-remote%2B10.112.30.123/home/ubuntu/lamini/main.ipynb#X25sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2'%3E3%3C/a%3E) name='init', 4](vscode-notebook-cell://ssh-remote%2B10.112.30.123/home/ubuntu/lamini/main.ipynb#X25sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3'%3E4%3C/a%3E) code='def init(self, builder, name):\n self.builder = builder\n self.name = name\n self.main = Function(program=self, name="main")\n self.functions = {"main": self.main}\n self.examples = []' 5](vscode-notebook-cell://ssh-remote%2B10.112.30.123/home/ubuntu/lamini/main.ipynb#X25sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4'%3E5%3C/a%3E) ) 6](vscode-notebook-cell://ssh-remote%2B10.112.30.123/home/ubuntu/lamini/main.ipynb#X25sdnNjb2RlLXJlbW90ZQ%3D%3D?line=5'%3E6%3C/a%3E) llm.save_data([function]) ----> 7](vscode-notebook-cell://ssh-remote%2B10.112.30.123/home/ubuntu/lamini/main.ipynb#X25sdnNjb2RlLXJlbW90ZQ%3D%3D?line=6'%3E7%3C/a%3E) answer = llm(input=Question(question=question), output_type=Answer) 9](vscode-notebook-cell://ssh-remote%2B10.112.30.123/home/ubuntu/lamini/main.ipynb#X25sdnNjb2RlLXJlbW90ZQ%3D%3D?line=8'%3E9%3C/a%3E) print(answer)

File ~/lamini/lib/python3.10/site-packages/llama/types/type.py:18, in Type.init(self, *args, *kwargs) 16 object.setattr(self, "fields_set", unvalidated.fields_set) 17 else: ---> 18 super().init(args, **kwargs) 20 self._value = Value(type(self), data=self)

File ~/lamini/lib/python3.10/site-packages/pydantic/main.py:341, in pydantic.main.BaseModel.init()

ValidationError: 1 validation error for Question question str type expected (type=type_error.str)

omonida commented 12 months ago

Thank you, the documentation has been updated!