Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: use local mit-tr instead of MIT self-hosted #16

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# OSX
.DS_Store

# IDE
.idea

# Local environment
.env
api.env
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
os.environ["TA1_UNIFIED_URL"] = "https://ta1:5"
os.environ["MIT_TR_URL"] = "http://mit:10"
os.environ["TDS_URL"] = "http://tds:15"
os.environ["OPENAI_API_KEY"] = "foo"
os.environ["LOG_LEVEL"] = "INFO"


Expand Down
10 changes: 2 additions & 8 deletions workers/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ def pdf_extractions(*args, **kwargs):


def data_card(*args, **kwargs):
openai_key = os.getenv("OPENAI_API_KEY")

dataset_id = kwargs.get("dataset_id")
artifact_id = kwargs.get("artifact_id")
Expand All @@ -251,16 +250,14 @@ def data_card(*args, **kwargs):
)
dataset_json = dataset_response.json()

params = {"gpt_key": openai_key}

files = {
"csv_file": ("csv_file", dataset_csv_string.encode()),
"doc_file": ("doc_file", doc_file),
}

url = f"{MIT_API}/cards/get_data_card"
logger.info(f"Sending dataset {dataset_id} to MIT service at {url}")
resp = requests.post(url, params=params, files=files)
resp = requests.post(url, files=files)
if resp.status_code != 200:
raise Exception(f"Failed response from MIT: {resp.status_code}")

Expand Down Expand Up @@ -308,7 +305,6 @@ def data_card(*args, **kwargs):


def model_card(*args, **kwargs):
openai_key = os.getenv("OPENAI_API_KEY")
model_id = kwargs.get("model_id")
paper_artifact_id = kwargs.get("paper_artifact_id")

Expand Down Expand Up @@ -339,8 +335,6 @@ def model_card(*args, **kwargs):

amr = get_model_from_tds(model_id).json()

params = {"gpt_key": openai_key}

files = {
"text_file": ("text_file", text_file),
"code_file": ("doc_file", code_file),
Expand All @@ -349,7 +343,7 @@ def model_card(*args, **kwargs):
url = f"{MIT_API}/cards/get_model_card"
logger.info(f"Sending model {model_id} to MIT service at {url}")

resp = requests.post(url, params=params, files=files)
resp = requests.post(url, files=files)
logger.info(f"Response received from MIT with status: {resp.status_code}")
logger.debug(f"TA 1 response object: {resp.json()}")

Expand Down