Skip to content

Commit

Permalink
tutorial66
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed May 21, 2024
1 parent d9a39d8 commit 41eb426
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 34 deletions.
Binary file added tutorial66/__pycache__/ticket.cpython-311.pyc
Binary file not shown.
18 changes: 7 additions & 11 deletions tutorial66/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import streamlit as st
from pymongo import MongoClient
import json,urllib
from langchain_openai import ChatOpenAI
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate
from ticket import generate_ticket


from ticket import gen_ticket
import json

llm=ChatOpenAI(model="gpt-4o",temperature=0.0)
prompt="""
Expand All @@ -20,7 +17,6 @@
follow the below conditions very strictly :
just include the json in the output nothing extra
"""

def genresponse(input):
query_with_prompt=PromptTemplate(
template=prompt,
Expand All @@ -37,13 +33,13 @@ def genresponse(input):
return data


st.title("AI driven HRMS app")
st.write("enter your instructions in english")
input=st.text_area("write your instruction")
st.title("AI Driven Service Desk Analyst")
st.write("enter your issue")
input=st.text_area("write your problem")
if input is not None:
btn=st.button("submit")
if btn:
response=genresponse(input)
st.write(response)

ticket=gen_ticket(response)
st.write(ticket)
11 changes: 11 additions & 0 deletions tutorial66/prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
you are an intelligent assistant who is expert in understanding user problem ,
you can translate any {instruction} into a json document to be used to create jira service ticket.
While returning the json make sure to use the below keys only :

Title
Summary

follow the below conditions very strictly :
just include the json in the output nothing extra
"""
45 changes: 22 additions & 23 deletions tutorial66/ticket.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
import requests
import json
import requests ,json

url="https://thetotaltechnology.atlassian.net/rest/api/2/issue"
headers={
"Accept": "application/json",
"Content-Type": "application/json"
"Accept":"application/json",
"Content-Type":"application/json"
}
def generate_ticket(data):
payload=json.dumps(
{
"fields": {
"project":
{
"id": "10000"
},
"summary": "created for test11",
"description": "Created for test11",
"issuetype": {
"name": "Task"
}
}
}
)
response=requests.post(url,headers=headers,data=payload,auth=(""))
data=response.json()
return data
def gen_ticket(data):
payload=json.dumps(
{
"fields":{
"project":{
"id":"10000",

},
"summary":data["Title"],
"description":data["Summary"],
"issuetype":{
"name":"Task"
}

}
}
)
response=requests.post(url,headers=headers,data=payload,auth=("[email protected]","xxxC"))
data=response.json()
return data
Binary file added tutorial66/tutorial66.pptx
Binary file not shown.

0 comments on commit 41eb426

Please sign in to comment.