kartavya17 commited on
Commit
40365dc
·
verified ·
1 Parent(s): 03ddf6a

Upload 4 files

Browse files
Files changed (4) hide show
  1. LLAMA3 model.rar +3 -0
  2. constants.py +1 -0
  3. main.py +41 -0
  4. requirements.txt +7 -0
LLAMA3 model.rar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed712b2e370f6f2cec1ee2bd35e046b076d7cb771adf1f9c40e94dca90996291
3
+ size 99508396
constants.py ADDED
@@ -0,0 +1 @@
 
 
1
+ openai_key='sk-proj-bqOf8lKa9hnV1KmGXedaT3BlbkFJwM8oiBEkmwEoYR7yxl63'
main.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_openai import ChatOpenAI
2
+ from langchain_core.prompts import ChatPromptTemplate
3
+ from langchain_core.output_parsers import StrOutputParser
4
+ from langchain_community.llms import Ollama
5
+ import os
6
+
7
+ import streamlit as st
8
+
9
+ from dotenv import load_dotenv
10
+ load_dotenv()
11
+
12
+ os.environ["OPENAI_API_KEY"]=os.getenv("OPENAI_API_KEY", "not found")
13
+ #langmith Tracking
14
+ os.environ["LANGCHAIN_TRACING_V2"]="true"
15
+ os.environ["LANGCHAIN_API_KEY"]=os.getenv("LANGCHAIN_API_KEY", "not found")
16
+
17
+ #Prompt Template
18
+
19
+ prompt = ChatPromptTemplate.from_messages(
20
+ [
21
+ ("system", "You are a world class helpful assistant.Please respond to the user."),
22
+ ("user","Question:{question}")
23
+ ]
24
+ )
25
+
26
+ #streamlit framework
27
+
28
+ st.title('LLAMA3 using Langchain :sunglasses:')
29
+ st.subheader("I am developed by :blue[Kartavya.] How can i assist you:question :")
30
+ input_text = st.text_input("")
31
+
32
+ #OLLAMA LLAma3
33
+
34
+ llm = Ollama(model="llama3")
35
+ output_parser = StrOutputParser()
36
+ chain = prompt|llm|output_parser
37
+
38
+ if st.button("Enter"):
39
+ st.write(chain.invoke({"question":input_text}))
40
+
41
+
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ openai
2
+ langchain
3
+ streamlit
4
+ langchain_openai
5
+ langchain_community
6
+ ollama
7
+ python-dotenv