Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
langchain models and 2 get endpoints for the title and answer
- Loading branch information
andizy
committed
Oct 29, 2023
1 parent
30f6f3f
commit f0181ed
Showing
19 changed files
with
236 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from django.shortcuts import render | ||
from rest_framework.response import Response | ||
from rest_framework.decorators import api_view | ||
from neomodel import db | ||
import requests | ||
import time | ||
|
||
# Create your views here. | ||
@api_view(['GET']) | ||
def getData(request): | ||
# user = db.cypher_query( | ||
# ''' | ||
# MATCH (n:User) | ||
# RETURN n | ||
# ''' | ||
# )[0] | ||
# print(user) | ||
# # return Response() | ||
|
||
# Fatjon logic to get data and store in graph | ||
# get data from API for different categories | ||
categories = ["SAP", "ServiceNow", "General", "MDE", "Guideline"] | ||
auth = ("BaselHack2023", "Tc13cspLs!eAve") | ||
|
||
|
||
for search_query in categories: | ||
|
||
# Define the API URL with the search query as a parameter | ||
api_url = f'https://bfgtest.service-now.com/api/besag/search_knowledge_baselhack2023/searchkb/{search_query}' | ||
# print(api_url) | ||
|
||
# Make a GET request to the API | ||
response = requests.get(api_url, auth=auth) | ||
# print(response) | ||
|
||
# Check if the request was successful (status code 200) | ||
if response.status_code == 200: | ||
data = response.json() | ||
# print(data["result"][0]) | ||
# Store data in the db | ||
for result in data["result"]: | ||
db.cypher_query( | ||
''' | ||
MERGE (d:Document{id: $result['number']}) | ||
SET d += $result, d.context = 'tbd', d.tags = 'tbd' | ||
''', result | ||
) | ||
else: | ||
# Handle the case where the API request fails | ||
print("API call failed!") | ||
|
||
# Sleep for the specified duration | ||
time.sleep(7) | ||
|
||
|
||
|
Binary file added
BIN
+5.99 MB
llm_api/app/documents/mydata/4113db52-1d4a-415d-bd03-fef154bdf0e1/data_level0.bin
Binary file not shown.
Binary file added
BIN
+100 Bytes
llm_api/app/documents/mydata/4113db52-1d4a-415d-bd03-fef154bdf0e1/header.bin
Binary file not shown.
Binary file added
BIN
+3.91 KB
llm_api/app/documents/mydata/4113db52-1d4a-415d-bd03-fef154bdf0e1/length.bin
Binary file not shown.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file added
BIN
+5.99 MB
llm_api/app/mydata/e29d41b1-7cb0-442e-81d6-b599157c716a/data_level0.bin
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+54.7 KB
llm_api/app/mydata/e29d41b1-7cb0-442e-81d6-b599157c716a/index_metadata.pickle
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+8.22 KB
llm_api/app/mydata/e29d41b1-7cb0-442e-81d6-b599157c716a/link_lists.bin
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters