Spaces:
Sleeping
Sleeping
matthewfarant
commited on
Commit
•
5d38be9
1
Parent(s):
7e99c90
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,34 @@
|
|
1 |
from langchain.prompts import PromptTemplate
|
2 |
from langchain_core.output_parsers import JsonOutputParser, StrOutputParser
|
3 |
from langchain_community.chat_models import ChatOllama
|
|
|
4 |
from langchain_core.tools import Tool
|
5 |
from langchain_google_community import GoogleSearchAPIWrapper
|
6 |
from firecrawl import FirecrawlApp
|
7 |
|
8 |
import gradio as gr
|
|
|
9 |
|
10 |
# Initialize LLM and Tools
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
google_search = GoogleSearchAPIWrapper()
|
15 |
os.environ["GOOGLE_CSE_ID"] = "72150c1d158b54108"
|
16 |
os.environ["GOOGLE_API_KEY"] = "AIzaSyAaNoF_a27HM3C87ObELRLTeVCrke_3OJA"
|
|
|
1 |
from langchain.prompts import PromptTemplate
|
2 |
from langchain_core.output_parsers import JsonOutputParser, StrOutputParser
|
3 |
from langchain_community.chat_models import ChatOllama
|
4 |
+
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
|
5 |
from langchain_core.tools import Tool
|
6 |
from langchain_google_community import GoogleSearchAPIWrapper
|
7 |
from firecrawl import FirecrawlApp
|
8 |
|
9 |
import gradio as gr
|
10 |
+
import os
|
11 |
|
12 |
# Initialize LLM and Tools
|
13 |
+
|
14 |
+
# local_llm = 'llama3.1'
|
15 |
+
# llama3 = ChatOllama(model=local_llm, temperature=1)
|
16 |
+
# llama3_json = ChatOllama(model=local_llm, format='json', temperature=0)
|
17 |
+
|
18 |
+
#
|
19 |
+
os.environ["HUGGINGFACEHUB_API_TOKEN"] = os.getenv('HF_KEY')
|
20 |
+
|
21 |
+
llm = HuggingFaceEndpoint(
|
22 |
+
repo_id="meta-llama/Meta-Llama-3.1-8B-Instruct",
|
23 |
+
task="text-generation",
|
24 |
+
max_new_tokens=1000,
|
25 |
+
do_sample=False,
|
26 |
+
repetition_penalty=1.03,
|
27 |
+
)
|
28 |
+
|
29 |
+
llama3 = ChatHuggingFace(llm=llm, temperature = 1)
|
30 |
+
llama3_json = ChatHuggingFace(llm=llm, format = 'json', temperature = 0)
|
31 |
+
|
32 |
google_search = GoogleSearchAPIWrapper()
|
33 |
os.environ["GOOGLE_CSE_ID"] = "72150c1d158b54108"
|
34 |
os.environ["GOOGLE_API_KEY"] = "AIzaSyAaNoF_a27HM3C87ObELRLTeVCrke_3OJA"
|