Skip to content

Commit

Permalink
Remove unnecessary directories during workflow execution
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbeevip committed Jul 4, 2024
1 parent b31c02a commit 3cefccc
Show file tree
Hide file tree
Showing 9 changed files with 677 additions and 657 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
install:
@poetry lock
@poetry install

lock:
@poetry update
@poetry lock

lint:
@poetry install --with lint
@poetry run black src
Expand Down
1,290 changes: 639 additions & 651 deletions poetry.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ packages = [{ include = "langchain_lab", from = "src" }]
[tool.poetry.dependencies]
python = "^3.11"
streamlit = "1.32.2"
langchain = "0.1.19"
langchain-openai = "0.1.6"
langchain-experimental = "0.0.58"
langchainhub = "0.1.15"
langchain = "0.2.6"
langchain-openai = "0.1.14"
langchain-experimental = "0.0.62"
langchainhub = "0.1.20"
faiss-cpu = "^1.7.4"
pandas = "^2.1.0"
python-dotenv = "^1.0.0"
Expand Down
13 changes: 13 additions & 0 deletions src/langchain_lab/core/audio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os

from openai import OpenAI


def openai_speech_to_text(audio_file_path):
client = OpenAI(base_url=os.environ["OPENAI_API_BASE"], api_key=os.environ["OPENAI_API_KEY"])
audio_file = open(audio_file_path, "rb")
transcription = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file
)
print(transcription.text)
3 changes: 2 additions & 1 deletion src/langchain_lab/core/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
from langchain.docstore.document import Document
from langchain.embeddings.base import Embeddings
from langchain.vectorstores import VectorStore
from langchain.vectorstores.faiss import FAISS
from langchain_community.embeddings import HuggingFaceEmbeddings, OpenAIEmbeddings
from langchain_community.vectorstores import FAISS


from langchain_lab import logger

Expand Down
Empty file added tests/__init__.py
Empty file.
Empty file added tests/langchain_lab/__init__.py
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions tests/langchain_lab/core/test_audio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import unittest
from unittest import TestCase

from langchain_lab.core.audio import openai_speech_to_text


class TestAudio(TestCase):

@unittest.skip("Skip test_transcriptions")
def test_transcriptions(self):
openai_speech_to_text("input.wav")


if __name__ == "__main__":
unittest.main()

0 comments on commit 3cefccc

Please sign in to comment.