clean oai

This commit is contained in:
Thomas Dhome Casanova (from Dev Box)
2025-01-22 21:25:40 -08:00
parent 93d9e2e12f
commit bb018460d7

View File

@@ -4,8 +4,6 @@ import logging
import base64 import base64
import requests import requests
# from computer_use_demo.gui_agent.llm_utils import is_image_path, encode_image
def is_image_path(text): def is_image_path(text):
# Checking if the input text ends with typical image file extensions # Checking if the input text ends with typical image file extensions
image_extensions = (".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".tif") image_extensions = (".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".tif")
@@ -19,14 +17,6 @@ def encode_image(image_path):
with open(image_path, "rb") as image_file: with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode("utf-8") return base64.b64encode(image_file.read()).decode("utf-8")
# from openai import OpenAI
# client = OpenAI(
# api_key=os.environ.get("OPENAI_API_KEY")
# )
def run_oai_interleaved(messages: list, system: str, llm: str, api_key: str, max_tokens=256, temperature=0): def run_oai_interleaved(messages: list, system: str, llm: str, api_key: str, max_tokens=256, temperature=0):
api_key = api_key or os.environ.get("OPENAI_API_KEY") api_key = api_key or os.environ.get("OPENAI_API_KEY")