|
|
|
@ -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'] |
|
|
|
|