phyloforfun commited on
Commit
18ab2c5
1 Parent(s): 64ffaff

Major update. Support for 15 LLMs, World Flora Online taxonomy validation, geolocation, 2 OCR methods, significant UI changes, stability improvements, consistent JSON parsing

Browse files
vouchervision/API_validation.py CHANGED
@@ -1,12 +1,14 @@
1
  import os, io, openai, vertexai
 
2
  from mistralai.client import MistralClient
3
  from mistralai.models.chat_completion import ChatMessage
4
  from langchain.schema import HumanMessage
5
  from langchain_openai import AzureChatOpenAI
6
  from vertexai.language_models import TextGenerationModel
7
  from vertexai.preview.generative_models import GenerativeModel
8
- from google.cloud import vision
9
  from datetime import datetime
 
10
 
11
 
12
 
@@ -184,7 +186,7 @@ class APIvalidation:
184
  try:
185
  # Assuming genai and vertexai are clients for Google services
186
  # os.environ["GOOGLE_API_KEY"] = os.getenv('PALM_API_KEY')
187
- # genai.configure(api_key=self.cfg_private['google_palm']['google_palm_api'])
188
  vertexai.init(project= os.getenv('GOOGLE_PROJECT_ID'), location=os.getenv('GOOGLE_LOCATION'))
189
 
190
  try:
 
1
  import os, io, openai, vertexai
2
+ import google.generativeai as genai
3
  from mistralai.client import MistralClient
4
  from mistralai.models.chat_completion import ChatMessage
5
  from langchain.schema import HumanMessage
6
  from langchain_openai import AzureChatOpenAI
7
  from vertexai.language_models import TextGenerationModel
8
  from vertexai.preview.generative_models import GenerativeModel
9
+ from google.cloud import vision, genai
10
  from datetime import datetime
11
+ import google.generativeai as genai
12
 
13
 
14
 
 
186
  try:
187
  # Assuming genai and vertexai are clients for Google services
188
  # os.environ["GOOGLE_API_KEY"] = os.getenv('PALM_API_KEY')
189
+ genai.configure(api_key=os.getenv('PALM_API_KEY'))
190
  vertexai.init(project= os.getenv('GOOGLE_PROJECT_ID'), location=os.getenv('GOOGLE_LOCATION'))
191
 
192
  try:
vouchervision/utils_VoucherVision.py CHANGED
@@ -441,6 +441,7 @@ class VoucherVision():
441
  openai.api_key = openai_api_key
442
 
443
  if self.has_key_google_project_id and self.has_key_google_project_location:
 
444
  vertexai.init(project=os.getenv('GOOGLE_PROJECT_ID'), location=os.getenv('GOOGLE_LOCATION'))
445
 
446
  if os.getenv('AZURE_API_KEY') is not None:
@@ -448,10 +449,10 @@ class VoucherVision():
448
  azure_api_key = os.getenv('AZURE_API_KEY')
449
  azure_api_base = os.getenv('AZURE_API_BASE')
450
  azure_organization = os.getenv('AZURE_ORGANIZATION')
451
- azure_api_type = os.getenv('AZURE_API_TYPE')
452
- azure_deployment_name = os.getenv('AZURE_DEPLOYMENT_NAME')
453
 
454
- if azure_api_version and azure_api_key and azure_api_base and azure_organization and azure_api_type and azure_deployment_name:
455
 
456
  self.has_key_azure_openai = True
457
  self.llm = AzureChatOpenAI(
 
441
  openai.api_key = openai_api_key
442
 
443
  if self.has_key_google_project_id and self.has_key_google_project_location:
444
+ genai.configure(api_key=os.getenv('PALM_API_KEY'))
445
  vertexai.init(project=os.getenv('GOOGLE_PROJECT_ID'), location=os.getenv('GOOGLE_LOCATION'))
446
 
447
  if os.getenv('AZURE_API_KEY') is not None:
 
449
  azure_api_key = os.getenv('AZURE_API_KEY')
450
  azure_api_base = os.getenv('AZURE_API_BASE')
451
  azure_organization = os.getenv('AZURE_ORGANIZATION')
452
+ # azure_api_type = os.getenv('AZURE_API_TYPE')
453
+ # azure_deployment_name = os.getenv('AZURE_DEPLOYMENT_NAME')
454
 
455
+ if azure_api_version and azure_api_key and azure_api_base and azure_organization:# and azure_api_type and azure_deployment_name:
456
 
457
  self.has_key_azure_openai = True
458
  self.llm = AzureChatOpenAI(