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

openai config #32

Merged
merged 1 commit into from
Mar 21, 2024
Merged
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
6 changes: 5 additions & 1 deletion ufo/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ def update_api_base(configs, agent):
api_version=configs[agent]["API_VERSION"]
)
configs[agent]["API_MODEL"] = configs[agent]["API_DEPLOYMENT_ID"]

elif configs[agent]["API_TYPE"].lower() == "openai":
if 'chat/completions' in configs[agent]["API_BASE"]:
configs[agent]["API_BASE"] = configs[agent]["API_BASE"][:-18] if configs[agent]["API_BASE"].endswith(
"/") else configs[agent]["API_BASE"][:-17]


def optimize_configs(configs):
update_api_base(configs,'APP_AGENT')
Expand Down
18 changes: 1 addition & 17 deletions ufo/llm/openai.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
import datetime
from typing import Any, Literal, Optional
from typing import Any, Optional
import openai
from openai import AzureOpenAI, OpenAI


available_models = Literal[ #for azure_ad
"gpt-35-turbo-20220309",
"gpt-35-turbo-16k-20230613",
"gpt-35-turbo-20230613",
"gpt-35-turbo-1106",

"gpt-4-20230321",
"gpt-4-20230613",
"gpt-4-32k-20230321",
"gpt-4-32k-20230613",
"gpt-4-1106-preview",
"gpt-4-0125-preview",

"gpt-4-visual-preview",
]


class OpenAIService:
def __init__(self, config, agent_type: str):
Expand Down