ajayspot commited on
Commit
310bb10
·
verified ·
1 Parent(s): 4c59c08

Upload folder using huggingface_hub

Browse files
atomic_concepts_gradio/20250124_182614_aone.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metrics_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and list all the metrics mentioned in the statement. Do not list anything that is not a metric. Do not include dimensions.",
3
+ "dimensions_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and identify all the dimensions that are not a metric. List the dimensions including time period and list that only and nothing else. Do not include metrics.",
4
+ "results": [
5
+ {
6
+ "question": "What is the MTD total order volume",
7
+ "metrics": [
8
+ "total order volume"
9
+ ],
10
+ "dimensions": [
11
+ "MTD (Month-to-Date)"
12
+ ]
13
+ },
14
+ {
15
+ "question": "Show total monthly order volume for the past 12 months.",
16
+ "metrics": [
17
+ "order volume"
18
+ ],
19
+ "dimensions": [
20
+ "Total monthly order volume",
21
+ "Past 12 months"
22
+ ]
23
+ }
24
+ ],
25
+ "llm_model": "gpt-4o",
26
+ "username": "achinta"
27
+ }
atomic_concepts_gradio/20250124_183108_aone.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metrics_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and list all the metrics mentioned in the statement. Do not list anything that is not a metric. Do not include dimensions.",
3
+ "dimensions_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and identify all the dimensions that are not a metric. List the dimensions including time period and list that only and nothing else. Do not include metrics.",
4
+ "results": [
5
+ {
6
+ "question": "What is the MTD total order volume",
7
+ "metrics": [
8
+ "MTD total order volume"
9
+ ],
10
+ "dimensions": [
11
+ "MTD (Month to Date)",
12
+ "Total Order Volume"
13
+ ]
14
+ },
15
+ {
16
+ "question": "Show total monthly order volume for the past 12 months.",
17
+ "metrics": [
18
+ "total monthly order volume"
19
+ ],
20
+ "dimensions": [
21
+ "monthly order volume",
22
+ "past 12 months"
23
+ ]
24
+ }
25
+ ],
26
+ "llm_model": "gpt-4o",
27
+ "username": "achinta"
28
+ }
atomic_concepts_gradio/20250124_183240_aone.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metrics_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and list all the metrics mentioned in the statement. Do not list anything that is not a metric. Do not include dimensions.",
3
+ "dimensions_prompt": "Forget all of our past conversations and treat this as a new conversation. As an expert Data Analyst in the Financial Securities Trading Industry, parse the following question \"{question}\" and identify all the dimensions that are not a metric. List the dimensions including time period and list that only and nothing else. Do not include metrics.",
4
+ "results": [
5
+ {
6
+ "question": "What is the MTD total order volume",
7
+ "metrics": [
8
+ "order volume"
9
+ ],
10
+ "dimensions": [
11
+ "MTD (Month to Date)",
12
+ "total order volume"
13
+ ]
14
+ },
15
+ {
16
+ "question": "Show total monthly order volume for the past 12 months.",
17
+ "metrics": [
18
+ "total monthly order volume"
19
+ ],
20
+ "dimensions": [
21
+ "monthly",
22
+ "past 12 months"
23
+ ]
24
+ }
25
+ ],
26
+ "llm_model": "gpt-4o",
27
+ "username": "achinta"
28
+ }
evaluate_atomic_matching.py CHANGED
@@ -101,12 +101,14 @@ def process_questions(llm_model: str, openai_api_Key: str, deploy_key: str, metr
101
  try:
102
  # Set up SSH key before git operations
103
  try:
 
104
  key_path = setup_ssh_key(deploy_key)
105
- except Exception as e:
106
- raise Exception(f"Failed to set up SSH key: {str(e)}")
107
 
108
- # Test SSH connection
109
- try:
 
 
 
110
  result = subprocess.run(['ssh', '-T', '-i', key_path, 'git@github.com'],
111
  capture_output=True,
112
  text=True)
@@ -120,8 +122,7 @@ def process_questions(llm_model: str, openai_api_Key: str, deploy_key: str, metr
120
  temp_dir = tempfile.mkdtemp()
121
 
122
  try:
123
- # Explicitly set the SSH command with the key
124
- ssh_command = f'ssh -i {key_path}'
125
  repo = Repo.clone_from(repo_url, temp_dir, env={"GIT_SSH_COMMAND": ssh_command})
126
 
127
  # Copy the new file to the cloned repo under atomic_concepts_gradio directory
@@ -161,53 +162,34 @@ def process_questions(llm_model: str, openai_api_Key: str, deploy_key: str, metr
161
  shutil.rmtree(temp_dir)
162
  except:
163
  pass
164
- try:
165
- os.remove(key_path) # Remove the SSH key file
166
- except:
167
- pass
168
 
169
  except Exception as e:
170
  error_message = f"Error pushing to repository: {str(e)}\nResults were saved locally to: {filepath}"
171
  return error_message, filepath
 
 
 
 
 
 
 
172
 
173
- def setup_ssh_key(ssh_key_content):
174
  try:
175
- if isinstance(ssh_key_content, dict) and 'name' in ssh_key_content and 'path' in ssh_key_content:
176
- with open(ssh_key_content['path'], 'r') as f:
177
- key_content = f.read()
178
- else:
179
- raise ValueError("Invalid SSH key format: Expected a file upload")
180
- validate_ssh_key(key_content)
181
- except ValueError as e:
 
 
 
 
 
 
182
  raise ValueError(f"Invalid SSH key: {str(e)}")
183
-
184
- # Create .ssh directory if it doesn't exist
185
- ssh_dir = os.path.expanduser('~/.ssh')
186
- os.makedirs(ssh_dir, exist_ok=True)
187
-
188
- # Save the key to a file
189
- key_path = os.path.join(ssh_dir, 'github_deploy_key')
190
- with open(key_path, 'w') as f:
191
- f.write(key_content)
192
-
193
- # Set correct permissions (600)
194
- os.chmod(key_path, stat.S_IRUSR | stat.S_IWUSR)
195
-
196
- # Configure ssh to use this key for github.com
197
- config_path = os.path.join(ssh_dir, 'config')
198
- config_content = f"""Host github.com
199
- HostName github.com
200
- IdentityFile {key_path}
201
- User git
202
- """
203
-
204
- with open(config_path, 'w') as f:
205
- f.write(config_content)
206
-
207
- # Set correct permissions for .ssh directory
208
- os.chmod(ssh_dir, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
209
-
210
- return key_path
211
 
212
  def handle_ssh_key(ssh_key):
213
  try:
 
101
  try:
102
  # Set up SSH key before git operations
103
  try:
104
+ # Save the key file and get its path
105
  key_path = setup_ssh_key(deploy_key)
 
 
106
 
107
+ # Explicitly set the SSH command with the deploy key file path
108
+ ssh_command = f'ssh -i {key_path} -o StrictHostKeyChecking=no'
109
+ os.environ['GIT_SSH_COMMAND'] = ssh_command
110
+
111
+ # Test SSH connection
112
  result = subprocess.run(['ssh', '-T', '-i', key_path, 'git@github.com'],
113
  capture_output=True,
114
  text=True)
 
122
  temp_dir = tempfile.mkdtemp()
123
 
124
  try:
125
+ # Clone using the SSH command with the key file
 
126
  repo = Repo.clone_from(repo_url, temp_dir, env={"GIT_SSH_COMMAND": ssh_command})
127
 
128
  # Copy the new file to the cloned repo under atomic_concepts_gradio directory
 
162
  shutil.rmtree(temp_dir)
163
  except:
164
  pass
 
 
 
 
165
 
166
  except Exception as e:
167
  error_message = f"Error pushing to repository: {str(e)}\nResults were saved locally to: {filepath}"
168
  return error_message, filepath
169
+ finally:
170
+ # Clean up the key file
171
+ try:
172
+ if 'key_path' in locals():
173
+ os.remove(key_path)
174
+ except:
175
+ pass
176
 
177
+ def setup_ssh_key(ssh_key_file):
178
  try:
179
+ # Check if a file was uploaded
180
+ if ssh_key_file is None:
181
+ raise ValueError("No SSH key file was uploaded")
182
+
183
+ # Save the key to the current working directory
184
+ key_path = os.path.join(os.getcwd(), 'github_deploy_key')
185
+ shutil.copy2(ssh_key_file.name, key_path)
186
+
187
+ # Set correct permissions (600)
188
+ os.chmod(key_path, stat.S_IRUSR | stat.S_IWUSR)
189
+
190
+ return key_path
191
+ except Exception as e:
192
  raise ValueError(f"Invalid SSH key: {str(e)}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  def handle_ssh_key(ssh_key):
195
  try: