Spaces:
Sleeping
Sleeping
Commit
·
6b041d9
1
Parent(s):
1f8a90f
adding chain
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import logging
|
|
5 |
from youtube_transcript_api import YouTubeTranscriptApi
|
6 |
from langchain.docstore.document import Document
|
7 |
from langchain_groq import ChatGroq
|
|
|
8 |
import chatops
|
9 |
|
10 |
logger = logging.getLogger(__name__)
|
@@ -30,14 +31,14 @@ def youtube_link_dataloader(video_link,max_video_length=1000):
|
|
30 |
def youtube_chat(API_key=None,llm_service='mistralai/Mistral-7B-v0.1',youtube_link=None,char_length=2000):
|
31 |
|
32 |
video_document = youtube_link_dataloader(video_link=youtube_link,max_video_length=char_length)
|
33 |
-
print("docuemt:",
|
34 |
|
35 |
if llm_service== 'mistralai/Mistral-7B-v0.1':
|
36 |
llm = chatops.get_hugging_face_model(
|
37 |
model_id="mistralai/Mistral-7B-v0.1",
|
38 |
API_key=API_key,
|
39 |
-
temperature=
|
40 |
-
max_tokens=
|
41 |
)
|
42 |
elif llm_service == 'OpenAI':
|
43 |
llm = chatops.get_openai_chat_model(API_key=API_key)
|
|
|
5 |
from youtube_transcript_api import YouTubeTranscriptApi
|
6 |
from langchain.docstore.document import Document
|
7 |
from langchain_groq import ChatGroq
|
8 |
+
from langchain.chains.summarize.chain import load_summarize_chain
|
9 |
import chatops
|
10 |
|
11 |
logger = logging.getLogger(__name__)
|
|
|
31 |
def youtube_chat(API_key=None,llm_service='mistralai/Mistral-7B-v0.1',youtube_link=None,char_length=2000):
|
32 |
|
33 |
video_document = youtube_link_dataloader(video_link=youtube_link,max_video_length=char_length)
|
34 |
+
print("docuemt:",video_document)
|
35 |
|
36 |
if llm_service== 'mistralai/Mistral-7B-v0.1':
|
37 |
llm = chatops.get_hugging_face_model(
|
38 |
model_id="mistralai/Mistral-7B-v0.1",
|
39 |
API_key=API_key,
|
40 |
+
temperature=0.1,
|
41 |
+
max_tokens=2048
|
42 |
)
|
43 |
elif llm_service == 'OpenAI':
|
44 |
llm = chatops.get_openai_chat_model(API_key=API_key)
|