simple function-calling chain.from langchain.pydantic_v1 import BaseModel, Fieldfrom enum import Enumclass Operation(Enum):    add = "+"    subtract = "-"    multiply = "*"    divide = "/"class Calculator(BaseModel):    """A calculator function"""    num1: float    num2: float    operation: Operation = Field(..., description="+,-,*,/")    def calculate(self):        if self.operation == Operation.add:            return self.num1 + self.num2        elif self.operation == Operation.subtract:            return self.num1 - self.num2        elif self.operation == Operation.multiply:            return self.num1 * self.num2        elif self.operation == Operation.divide:            if self.num2 != 0:                return self.num1 / self.num2            else:                return "Cannot divide by zero"from langchain.utils.openai_functions import convert_pydantic_to_openai_functionfrom langchain.pydantic_v1 import BaseModelfrom pprint import pprintopenai_function_def = convert_pydantic_to_openai_function(Calculator)pprint(openai_function_def)    {'description': 'A calculator function',     'name': 'Calculator',     'parameters': {'description': 'A calculator function',                    'properties': {'num1': {'title': 'Num1', 'type': 'number'},                                   'num2': {'title': 'Num2', 'type': 'number'},                                   'operation': {'allOf': [{'description': 'An '                                                                           'enumeration.',                                                            'enum': ['+',                                                                     '-',                                                                     '*',                                                                     '/'],                                                            'title': 'Operation'}],                                                 'description': '+,-,*,/'}},                    'required':
This notebook demonstrates how to directly load data from LangSmith's LLM runs and fine-tune a model on that data.
This notebook demonstrates how to directly load data from LangSmith's LLM runs and fine-tune a model on that data. ->: simple function-calling chain.from langchain.pydantic_v1 import BaseModel, Fieldfrom enum import Enumclass Operation(Enum):    add = "+"    subtract = "-"    multiply = "*"    divide = "/"class Calculator(BaseModel):    """A calculator function"""    num1: float    num2: float    operation: Operation = Field(..., description="+,-,*,/")    def calculate(self):        if self.operation == Operation.add:            return self.num1 + self.num2        elif self.operation == Operation.subtract:            return self.num1 - self.num2        elif self.operation == Operation.multiply:            return self.num1 * self.num2        elif self.operation == Operation.divide:            if self.num2 != 0:                return self.num1 / self.num2            else:                return "Cannot divide by zero"from langchain.utils.openai_functions import convert_pydantic_to_openai_functionfrom langchain.pydantic_v1 import BaseModelfrom pprint import pprintopenai_function_def = convert_pydantic_to_openai_function(Calculator)pprint(openai_function_def)    {'description': 'A calculator function',     'name': 'Calculator',     'parameters': {'description': 'A calculator function',                    'properties': {'num1': {'title': 'Num1', 'type': 'number'},                                   'num2': {'title': 'Num2', 'type': 'number'},                                   'operation': {'allOf': [{'description': 'An '                                                                           'enumeration.',                                                            'enum': ['+',                                                                     '-',                                                                     '*',                                                                     '/'],                                                            'title': 'Operation'}],                                                 'description': '+,-,*,/'}},                    'required':