Spaces:
Sleeping
Sleeping
Update csv_agent.py
Browse files- csv_agent.py +7 -6
csv_agent.py
CHANGED
|
@@ -7,16 +7,17 @@ client = InferenceClient(
|
|
| 7 |
)
|
| 8 |
|
| 9 |
def generate_code(prompt):
|
| 10 |
-
full_prompt = f"""You are a Python Pandas
|
| 11 |
-
Write Python Pandas
|
| 12 |
-
{prompt}
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
response = client.text_generation(
|
| 16 |
prompt=full_prompt,
|
| 17 |
-
max_new_tokens=200,
|
| 18 |
temperature=0.2,
|
| 19 |
top_p=0.9,
|
| 20 |
repetition_penalty=1.05
|
| 21 |
)
|
| 22 |
-
return response
|
|
|
|
| 7 |
)
|
| 8 |
|
| 9 |
def generate_code(prompt):
|
| 10 |
+
full_prompt = f"""You are a professional Python Pandas developer.
|
| 11 |
+
Write a complete, executable, valid Python Pandas script to perform the following task on a DataFrame named df:
|
| 12 |
+
Task: {prompt}
|
| 13 |
+
Make sure the code can be executed without any syntax errors.
|
| 14 |
+
Output only valid Python code. No explanation, no comments."""
|
| 15 |
|
| 16 |
response = client.text_generation(
|
| 17 |
prompt=full_prompt,
|
| 18 |
+
max_new_tokens=200, # Updated token limit
|
| 19 |
temperature=0.2,
|
| 20 |
top_p=0.9,
|
| 21 |
repetition_penalty=1.05
|
| 22 |
)
|
| 23 |
+
return response
|