ajayspot commited on
Commit
28eae7b
·
verified ·
1 Parent(s): 3c2faf0

Upload folder using huggingface_hub

Browse files
atomic_concepts_gradio/20250124_165956_angelone.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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",
22
+ "Order.Volume",
23
+ "Past.12.Months"
24
+ ]
25
+ }
26
+ ],
27
+ "llm_model": "gpt-4o",
28
+ "username": "achinta"
29
+ }
evaluate_atomic_matching.py CHANGED
@@ -99,26 +99,53 @@ def process_questions(llm_model: str, openai_api_Key: str, deploy_key: str, metr
99
 
100
  # Push to git repo and verify
101
  try:
 
 
 
 
102
  # Write deploy key to temporary file with proper line endings
103
  key_file = os.path.join(script_dir, "deploy_key")
104
- deploy_key_cleaned = deploy_key.strip().replace('\r\n', '\n')
 
 
 
 
 
 
 
 
 
 
 
105
  with open(key_file, 'w', newline='\n') as f:
106
  f.write(deploy_key_cleaned)
107
 
108
  # Ensure correct permissions for SSH key
109
  os.chmod(key_file, 0o600)
110
 
111
- # Set up Git SSH command with more verbose output for debugging
112
- ssh_command = f'ssh -v -i {key_file} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
 
 
 
 
 
 
113
  os.environ['GIT_SSH_COMMAND'] = ssh_command
114
 
115
- # Test SSH connection before attempting clone
116
  try:
117
- subprocess.run(['ssh', '-T', '-i', key_file, '-o', 'StrictHostKeyChecking=no',
118
- '-o', 'UserKnownHostsFile=/dev/null', 'git@github.com'],
119
- capture_output=True, timeout=10)
 
 
 
 
 
 
120
  except subprocess.CalledProcessError as e:
121
- raise Exception(f"SSH connection test failed: {e.stderr.decode() if e.stderr else str(e)}")
122
  except Exception as e:
123
  raise Exception(f"SSH connection test failed: {str(e)}")
124
 
 
99
 
100
  # Push to git repo and verify
101
  try:
102
+ # Validate and clean the deploy key
103
+ if not deploy_key.startswith('-----BEGIN'):
104
+ raise Exception("Invalid SSH key format. Key must begin with '-----BEGIN'")
105
+
106
  # Write deploy key to temporary file with proper line endings
107
  key_file = os.path.join(script_dir, "deploy_key")
108
+ deploy_key_cleaned = deploy_key.strip()
109
+
110
+ # Ensure key has proper line endings and format
111
+ key_lines = deploy_key_cleaned.split('\n')
112
+ key_lines = [line.strip() for line in key_lines] # Remove any extra whitespace
113
+ deploy_key_cleaned = '\n'.join(key_lines)
114
+
115
+ # Ensure the key ends with a newline
116
+ if not deploy_key_cleaned.endswith('\n'):
117
+ deploy_key_cleaned += '\n'
118
+
119
+ # Write the key with proper permissions
120
  with open(key_file, 'w', newline='\n') as f:
121
  f.write(deploy_key_cleaned)
122
 
123
  # Ensure correct permissions for SSH key
124
  os.chmod(key_file, 0o600)
125
 
126
+ # Print key file contents for debugging (remove in production)
127
+ with open(key_file, 'r') as f:
128
+ key_content = f.read()
129
+ if not key_content.startswith('-----BEGIN'):
130
+ raise Exception("Key file validation failed - incorrect format")
131
+
132
+ # Set up Git SSH command with more verbose output
133
+ ssh_command = f'ssh -vvv -i {key_file} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
134
  os.environ['GIT_SSH_COMMAND'] = ssh_command
135
 
136
+ # Test SSH connection
137
  try:
138
+ result = subprocess.run(
139
+ ['ssh', '-T', '-i', key_file, '-o', 'StrictHostKeyChecking=no',
140
+ '-o', 'UserKnownHostsFile=/dev/null', 'git@github.com'],
141
+ capture_output=True,
142
+ text=True,
143
+ timeout=10
144
+ )
145
+ if result.returncode != 1: # GitHub's SSH test always returns 1 when successful
146
+ raise Exception(f"SSH test failed with return code {result.returncode}\nOutput: {result.stderr}")
147
  except subprocess.CalledProcessError as e:
148
+ raise Exception(f"SSH connection test failed: {e.stderr if e.stderr else str(e)}")
149
  except Exception as e:
150
  raise Exception(f"SSH connection test failed: {str(e)}")
151