Browse Source

fixed local

pull/185/head
jad2121 12 months ago
parent
commit
d1463e9cc7
  1. 7
      installer/client/cli/utils.py

7
installer/client/cli/utils.py

@ -40,9 +40,8 @@ class Standalone:
apikey = os.environ["OPENAI_API_KEY"]
self.client = OpenAI()
self.client.api_key = apikey
except FileNotFoundError:
except:
print("No API key found. Use the --apikey option to set the key")
sys.exit()
self.local = False
self.config_pattern_directory = config_directory
self.pattern = pattern
@ -253,10 +252,10 @@ class Standalone:
gptlist = []
fullOllamaList = []
claudeList = ['claude-3-opus-20240229']
try:
headers = {
"Authorization": f"Bearer {self.client.api_key}"
}
response = requests.get(
"https://api.openai.com/v1/models", headers=headers)
@ -274,6 +273,8 @@ class Standalone:
else:
print(f"Failed to fetch models: HTTP {response.status_code}")
sys.exit()
except:
print('No OpenAI API key found. Please run fabric --setup and add the key if you wish to interact with openai')
import ollama
try:
default_modelollamaList = ollama.list()['models']

Loading…
Cancel
Save