-
Notifications
You must be signed in to change notification settings - Fork 22
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
Azure OpenAI backend #13
Comments
For sure! I welcome any and all contributions~ |
I have a working Azure OpenAI backend manually tested with this code snippet import pandas as pd
import os
import sketch
# Configure Azure-OpenAI
os.environ["SKETCH_USE_REMOTE_LAMBDAPROMPT"] = "False"
os.environ['LAMBDAPROMPT_BACKEND'] = 'Azure-OpenAI'
os.environ['OPENAI_API_KEY'] = my_api_key
os.environ['OPENAI_API_URL']="https://mygpt4.openai.azure.com/"
os.environ['OPENAI_API_VERSION']="2023-03-15-preview"
os.environ['OPENAI_MODEL']="GPT4-32k"
# Sample DataFrame
df = pd.DataFrame({
"country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
"gdp": [19294482071552, 2891615567872, 2411255037952, 3435817336832, 1745433788416, 1181205135360, 1607402389504, 1490967855104, 4380756541440, 14631844184064],
"happiness_index": [6.94, 7.16, 6.66, 7.07, 6.38, 6.4, 7.23, 7.22, 5.87, 5.12]
})
df.sketch.ask("Which are the European countries?") which returns df.sketch.howto("How to get the top 3 happiest countries?") returns # First, sort the dataframe by the happiness_index column in descending order
sorted_df = df.sort_values(by='happiness_index', ascending=False)
# Then, select the top 3 rows of the sorted dataframe
top_3_happiest_countries = sorted_df.head(3)
# Display the results
print(top_3_happiest_countries) I have a few comments/questions though:
|
Sorry about the late response here. I really appreciate the work you're doing!!
Maybe making subclasses of the OpenAICompletion with the class OpenAIGPT4Completion(OpenAICompletion)
def __init__(self, *args, **kwargs):
super().__init__(self, *args, model='gpt-4', **kwargs) and then adding keywords to the
This means that you can leave variables in there, such as
Note, the OpenAI implementations are tested though, via patching the http request part -> https://github.com/approximatelabs/lambdaprompt/blob/main/tests/test_gpt3.py Maybe something like this is best way to go for testing. |
Also, feel free to open up a PR, it'll be easier to iterate on code feedback there~ |
Hi,
Would you be interested if I PR an Azure OpenAI backend?
The text was updated successfully, but these errors were encountered: