Spaces:
Runtime error
Runtime error
DiamondYin
commited on
Commit
•
464c4cb
1
Parent(s):
d6ff146
Update app_utils.py
Browse files- app_utils.py +2 -2
app_utils.py
CHANGED
@@ -7,7 +7,7 @@ from pydub import AudioSegment # AudioSegment is a class in the pydub module
|
|
7 |
from pydub.playback import play # play is a function in the pydub.playback module that can be used to play audio files.
|
8 |
import logging
|
9 |
import numpy as np
|
10 |
-
|
11 |
from langchain import OpenAI
|
12 |
from langchain.chains import RetrievalQA # RetrievalQA is a class in the langchain.chains module that can be used to build a retrieval-based question answering system.
|
13 |
from langchain.vectorstores import Chroma # Chroma is a class in the langchain.vectorstores module that can be used to store vectors.
|
@@ -27,7 +27,7 @@ from tenacity import (
|
|
27 |
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
28 |
@st.cache_data
|
29 |
def embedding_from_string(input: str, model: str) -> list:
|
30 |
-
response =
|
31 |
embedding = response["data"][0]["embedding"]
|
32 |
return embedding
|
33 |
|
|
|
7 |
from pydub.playback import play # play is a function in the pydub.playback module that can be used to play audio files.
|
8 |
import logging
|
9 |
import numpy as np
|
10 |
+
import openai
|
11 |
from langchain import OpenAI
|
12 |
from langchain.chains import RetrievalQA # RetrievalQA is a class in the langchain.chains module that can be used to build a retrieval-based question answering system.
|
13 |
from langchain.vectorstores import Chroma # Chroma is a class in the langchain.vectorstores module that can be used to store vectors.
|
|
|
27 |
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
28 |
@st.cache_data
|
29 |
def embedding_from_string(input: str, model: str) -> list:
|
30 |
+
response = openai.Embedding.create(input=input, model=model)
|
31 |
embedding = response["data"][0]["embedding"]
|
32 |
return embedding
|
33 |
|