Spaces:
Build error
Build error
amyh commited on
Commit ·
c0418b9
1
Parent(s): ceb59d1
removed unneeded
Browse files- assistant_data.json +0 -1
- create.py +0 -59
- file_data.json +0 -1
- vector_data.json +0 -1
assistant_data.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"assistant_id": "asst_URwetnNCsUQrP5X0VtpFglJe"}
|
|
|
|
|
|
create.py
DELETED
|
@@ -1,59 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import os
|
| 3 |
-
import dotenv
|
| 4 |
-
from openai import OpenAI
|
| 5 |
-
|
| 6 |
-
import openai
|
| 7 |
-
from store import save_assistant_id, load_assistant_id # Import from your store module
|
| 8 |
-
dotenv.load_dotenv()
|
| 9 |
-
|
| 10 |
-
# OpenAI API Key
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
# Example usage (replace with your actual file paths)
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
# Store user sessions (threads)
|
| 19 |
-
import openai
|
| 20 |
-
import os
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
def create_assistant(client): # Add client and optional parameters
|
| 24 |
-
"""Retrieves existing assistant ID or creates a new one if not found."""
|
| 25 |
-
|
| 26 |
-
ASSISTANT_ID = load_assistant_id() # Try to load existing ID
|
| 27 |
-
|
| 28 |
-
if ASSISTANT_ID is None: # Create if not found
|
| 29 |
-
try:
|
| 30 |
-
# Create new assistant if none exists
|
| 31 |
-
assistant = client.beta.assistants.create(
|
| 32 |
-
name="Admissions Assistant",
|
| 33 |
-
instructions=" Take in the users school information and what kind of admissions policy they use. You help users by answering queries and giving feedback on the schools admissions policies. And offer to compare Free school meals data from neighbouring schools in the spreadsheet ",
|
| 34 |
-
tools=[{"type": "file_search"}], # Uses OpenAI’s built-in vector store
|
| 35 |
-
model="gpt-4o-mini"
|
| 36 |
-
)
|
| 37 |
-
ASSISTANT_ID = assistant.id
|
| 38 |
-
save_assistant_id(ASSISTANT_ID) # Save the new ID
|
| 39 |
-
print(f"New assistant created with ID: {ASSISTANT_ID}")
|
| 40 |
-
except Exception as e: # Handle potential errors during assistant creation
|
| 41 |
-
print(f"Error creating assistant: {e}")
|
| 42 |
-
return None # Return None to indicate failure
|
| 43 |
-
|
| 44 |
-
else:
|
| 45 |
-
print(f"Using existing assistant with ID: {ASSISTANT_ID}")
|
| 46 |
-
|
| 47 |
-
return ASSISTANT_ID # Return the assistant ID (whether existing or newly created)
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
if __name__ == "__main__":
|
| 53 |
-
client = OpenAI()
|
| 54 |
-
create_assistant(client)
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file_data.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"file_ids": ["file-W4AhQ347Sevk25GGLdsKzV", "file-8WnTuEngPpY1Bw2J1fkkZ5", "file-VQLcs39bvCuJVCTswPRumx", "file-XrdtvoMwpJcwd79yFXKR4K", "file-78jD4FwCusvhkms68H5Gwd"]}
|
|
|
|
|
|
vector_data.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"vector_id": "vs_67b89fe6267c819190215a2086624c1a"}
|
|
|
|
|
|