Promptify
Promptify copied to clipboard
Error in model execution: RetryError[<Future at 0x7efc1406b040 state=finished raised APIRemovedInV1>]
Hi everyone, I am encountering an error while using Azure OpenAI. The code was running fine when I executed it on Google Colab, but it is raising an error when I run it on GitHub Codespace Jupyter Notebook. The code in both platforms is exactly the same. Below is my code in Jupyter Notebook:
Access to ALL Credentials
import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
api_key = os.environ.get("OPENAI_API_KEY")
api_base = os.environ.get("OPENAI_API_BASE")
api_version = os.environ.get("OPENAI_API_VERSION")
api_type = os.environ.get("OPENAI_API_BASE")
print(f'API_KEY: {api_key}')
print(f'API BASE: {api_base}')
print(f'API VERSION: {api_version}')
print(f'API TYPE: {api_type}')
Define any LLM model (such as GPT-3) ✅
from promptify import Prompter, OpenAI, Pipeline, Azure
# Define the API key for the OpenAI model
# Create an instance of the OpenAI model
model = Azure(api_key=api_key, api_base=api_base, api_version=api_version, api_type=api_type, engine='gpt-35-turbo')
prompter = Prompter('multilabel_classification.jinja')
pipe = Pipeline(prompter , model)
# Example sentence for demonstration
sent = "The patient is a 93-year-old female with a medical history of chronic right hip pain, \
osteoporosis, hypertension, depression, and chronic atrial fibrillation admitted for evaluation \
and management of severe nausea and vomiting and urinary tract infection"
print(sent)
1: MultiLabel Text Classification Example in 2 Lines of code, with no training data required 🚀
result = pipe.fit(n_output_labels = 5,
domain = 'clinical', # it could be any domain such as -> financial, education, biomedical etc
text_input = sent,
labels = None)
# Output
result
0%| | 0/1 [00:13<?, ?it/s] Error in model execution: RetryError[<Future at 0x7efc140416f0 state=finished raised APIRemovedInV1>]
I got an error in the corresponding notebook for both reasons:
- nlp_prompter is used in the original code, while pipe seems the appropriate choice, as @mingjun1120 has used here.
- TypeError: Pipeline.fit() got multiple values for argument 'text_input': I cannot run even for the provided example.
Any ideas?