def call_gpt4_endpoint()

in Evaluation/ModelEvaluation/model_endpoints.py [0:0]


    def call_gpt4_endpoint(self: Self, query: str) -> Response:
        endpoint = self.env["gpt4"]["endpoint"]
        key = self.env["gpt4"]["key"]

        headers = {"Content-Type": "application/json", "api-key": key}

        payload = {"messages": [{"role": "user", "content": query}], "max_tokens": 500}

        output = self.query(endpoint=endpoint, headers=headers, payload=payload)
        print(f'output{output}')
        response = output["choices"][0]["message"]["content"]
        return {"query": query, "response": response}