Auto-update: Thu Aug 8 18:15:27 PDT 2024
This commit is contained in:
parent
9ec5a15d2f
commit
93bae55f31
5 changed files with 10 additions and 11 deletions
|
@ -119,7 +119,6 @@ TTS_OUTPUT_DIR = TTS_DIR / 'outputs'
|
||||||
os.makedirs(TTS_OUTPUT_DIR, exist_ok=True)
|
os.makedirs(TTS_OUTPUT_DIR, exist_ok=True)
|
||||||
TTS_SEGMENTS_DIR = TTS_DIR / 'segments'
|
TTS_SEGMENTS_DIR = TTS_DIR / 'segments'
|
||||||
os.makedirs(TTS_SEGMENTS_DIR, exist_ok=True)
|
os.makedirs(TTS_SEGMENTS_DIR, exist_ok=True)
|
||||||
ELEVENLABS_API_KEY = os.getenv("ELEVENLABS_API_KEY")
|
|
||||||
|
|
||||||
# Calendar & email account
|
# Calendar & email account
|
||||||
MS365_TOGGLE = True if os.getenv("MS365_TOGGLE") == "True" else False
|
MS365_TOGGLE = True if os.getenv("MS365_TOGGLE") == "True" else False
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
GLOBAL_API_KEYS:
|
GLOBAL:
|
||||||
- DEPRECATED
|
- DEPRECATED
|
||||||
OPENAI: 'sk-YOUR_OPENAI_API_KEY'
|
OPENAI: 'sk-YOUR_OPENAI_API_KEY'
|
||||||
VISUALCROSSING: 'YOUR_VC_API_KEY'
|
VISUALCROSSING: 'YOUR_VC_API_KEY'
|
||||||
|
|
|
@ -21,4 +21,4 @@ elevenlabs:
|
||||||
Attenborough: "b42GBisbu9r5m5n6pHF7"
|
Attenborough: "b42GBisbu9r5m5n6pHF7"
|
||||||
Victoria: "7UBkHqZOtFRLq6cSMQQg"
|
Victoria: "7UBkHqZOtFRLq6cSMQQg"
|
||||||
|
|
||||||
api_key: "{{ SECRET.ELEVENLABS_API_KEY }}"
|
api_key: "{{ SECRET.ELEVENLABS }}"
|
||||||
|
|
|
@ -26,7 +26,7 @@ import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import html2text
|
import html2text
|
||||||
import markdown
|
import markdown
|
||||||
from sijapi import L, Llm, LLM_SYS_MSG, REQUESTS_DIR, OBSIDIAN_CHROMADB_COLLECTION, OBSIDIAN_VAULT_DIR, DOC_DIR, OPENAI_API_KEY, SUMMARY_INSTRUCT, SUMMARY_CHUNK_SIZE, SUMMARY_TPW, SUMMARY_CHUNK_OVERLAP, SUMMARY_LENGTH_RATIO, SUMMARY_TOKEN_LIMIT, SUMMARY_MIN_LENGTH, SUMMARY_MODEL
|
from sijapi import L, Llm, LLM_SYS_MSG, REQUESTS_DIR, OBSIDIAN_CHROMADB_COLLECTION, OBSIDIAN_VAULT_DIR, DOC_DIR, SUMMARY_INSTRUCT, SUMMARY_CHUNK_SIZE, SUMMARY_TPW, SUMMARY_CHUNK_OVERLAP, SUMMARY_LENGTH_RATIO, SUMMARY_TOKEN_LIMIT, SUMMARY_MIN_LENGTH, SUMMARY_MODEL
|
||||||
from sijapi.utilities import convert_to_unix_time, sanitize_filename, ocr_pdf, clean_text, should_use_ocr, extract_text_from_pdf, extract_text_from_docx, read_text_file, str_to_bool, get_extension
|
from sijapi.utilities import convert_to_unix_time, sanitize_filename, ocr_pdf, clean_text, should_use_ocr, extract_text_from_pdf, extract_text_from_docx, read_text_file, str_to_bool, get_extension
|
||||||
from sijapi.routers import tts
|
from sijapi.routers import tts
|
||||||
from sijapi.routers.asr import transcribe_audio
|
from sijapi.routers.asr import transcribe_audio
|
||||||
|
@ -405,7 +405,7 @@ def query_gpt4(llmPrompt: List = [], system_msg: str = "", user_msg: str = "", m
|
||||||
{"role": "system", "content": system_msg},
|
{"role": "system", "content": system_msg},
|
||||||
{"role": "user", "content": user_msg}
|
{"role": "user", "content": user_msg}
|
||||||
]
|
]
|
||||||
LLM = OpenAI(api_key=OPENAI_API_KEY)
|
LLM = OpenAI(api_key=Llm.openai.key)
|
||||||
response = LLM.chat.completions.create(
|
response = LLM.chat.completions.create(
|
||||||
model="gpt-4",
|
model="gpt-4",
|
||||||
messages=messages,
|
messages=messages,
|
||||||
|
@ -435,7 +435,7 @@ def llava(image_base64, prompt):
|
||||||
return "" if "pass" in response["response"].lower() else response["response"]
|
return "" if "pass" in response["response"].lower() else response["response"]
|
||||||
|
|
||||||
def gpt4v(image_base64, prompt_sys: str, prompt_usr: str, max_tokens: int = 150):
|
def gpt4v(image_base64, prompt_sys: str, prompt_usr: str, max_tokens: int = 150):
|
||||||
VISION_LLM = OpenAI(api_key=OPENAI_API_KEY)
|
VISION_LLM = OpenAI(api_key=Llm.openai.key)
|
||||||
response_1 = VISION_LLM.chat.completions.create(
|
response_1 = VISION_LLM.chat.completions.create(
|
||||||
model="gpt-4-vision-preview",
|
model="gpt-4-vision-preview",
|
||||||
messages=[
|
messages=[
|
||||||
|
|
|
@ -49,7 +49,7 @@ async def list_wav_files():
|
||||||
async def list_11l_voices():
|
async def list_11l_voices():
|
||||||
formatted_list = ""
|
formatted_list = ""
|
||||||
url = "https://api.elevenlabs.io/v1/voices"
|
url = "https://api.elevenlabs.io/v1/voices"
|
||||||
headers = {"xi-api-key": Tts.elevenlabs.api_key}
|
headers = {"xi-api-key": Tts.elevenlabs.key}
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
try:
|
try:
|
||||||
response = await client.get(url, headers=headers)
|
response = await client.get(url, headers=headers)
|
||||||
|
@ -220,9 +220,9 @@ async def determine_voice_id(voice_name: str) -> str:
|
||||||
debug(f"Found voice ID in config - {voice_id}")
|
debug(f"Found voice ID in config - {voice_id}")
|
||||||
return voice_id
|
return voice_id
|
||||||
|
|
||||||
debug(f"Requested voice not among the voices specified in config/tts.yaml. Checking with ElevenLabs API using api_key: {Tts.elevenlabs.api_key}.")
|
debug(f"Requested voice not among the voices specified in config/tts.yaml. Checking with ElevenLabs API using api_key: {Tts.elevenlabs.key}.")
|
||||||
url = "https://api.elevenlabs.io/v1/voices"
|
url = "https://api.elevenlabs.io/v1/voices"
|
||||||
headers = {"xi-api-key": Tts.elevenlabs.api_key}
|
headers = {"xi-api-key": Tts.elevenlabs.key}
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
try:
|
try:
|
||||||
response = await client.get(url, headers=headers)
|
response = await client.get(url, headers=headers)
|
||||||
|
@ -263,7 +263,7 @@ async def elevenlabs_tts(model: str, input_text: str, voice: str, title: str = N
|
||||||
"model_id": model
|
"model_id": model
|
||||||
}
|
}
|
||||||
# Make sure this is the correct way to access the API key
|
# Make sure this is the correct way to access the API key
|
||||||
headers = {"Content-Type": "application/json", "xi-api-key": Tts.elevenlabs.api_key}
|
headers = {"Content-Type": "application/json", "xi-api-key": Tts.elevenlabs.key}
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient(timeout=httpx.Timeout(300.0)) as client:
|
async with httpx.AsyncClient(timeout=httpx.Timeout(300.0)) as client:
|
||||||
response = await client.post(url, json=payload, headers=headers)
|
response = await client.post(url, json=payload, headers=headers)
|
||||||
|
@ -447,7 +447,7 @@ async def get_audio_stream(model: str, input_text: str, voice: str):
|
||||||
"text": input_text,
|
"text": input_text,
|
||||||
"model_id": "eleven_turbo_v2"
|
"model_id": "eleven_turbo_v2"
|
||||||
}
|
}
|
||||||
headers = {"Content-Type": "application/json", "xi-api-key": Tts.elevenlabs.api_key}
|
headers = {"Content-Type": "application/json", "xi-api-key": Tts.elevenlabs.key}
|
||||||
response = requests.post(url, json=payload, headers=headers)
|
response = requests.post(url, json=payload, headers=headers)
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
|
Loading…
Reference in a new issue