leofeltrin commited on
Commit
7122f32
·
1 Parent(s): 512fe63

Corrigir guardrail: aceitar qualquer idioma e corrigir erro de tipo no setup

Browse files
Files changed (2) hide show
  1. app.py +6 -1
  2. gensim/utils.py +8 -7
app.py CHANGED
@@ -165,7 +165,12 @@ def setup(api_key, option_choice, model_choice, target_task_name):
165
  demo_runner = DemoRunner()
166
 
167
  if option_choice == 'top-down':
168
- info = demo_runner.setup_top_down(api_key, target_task_name, model_choice) + option_choice
 
 
 
 
 
169
  # elif option_choice == 'bottom-up':
170
  # info = demo_runner.setup(api_key, model_choice) + option_choice
171
  else:
 
165
  demo_runner = DemoRunner()
166
 
167
  if option_choice == 'top-down':
168
+ result = demo_runner.setup_top_down(api_key, target_task_name, model_choice)
169
+ # Se retornou tupla (erro, None), retornar diretamente
170
+ if isinstance(result, tuple) and len(result) == 2 and result[1] is None:
171
+ return result
172
+ # Caso contrário, é string de sucesso, concatenar com option_choice
173
+ info = result + option_choice
174
  # elif option_choice == 'bottom-up':
175
  # info = demo_runner.setup(api_key, model_choice) + option_choice
176
  else:
gensim/utils.py CHANGED
@@ -402,8 +402,9 @@ def validate_task_input_with_llm(user_input, interaction_txt=None):
402
  prompt = f"""You are a validation system for a robotic simulation framework. Your job is to check if a user's task request is feasible within the system's limitations.
403
 
404
  SYSTEM LIMITATIONS:
405
- 1. **Available Primitives**: Only PickPlace (pick and place) and Push are available. No cutting, breaking, throwing, or destructive actions.
406
- 2. **Available Assets**: Only these assets exist:
 
407
  - stacking/block.urdf (blocks)
408
  - stacking/ball.urdf (balls/spheres)
409
  - stacking/stand.urdf (stands/bases)
@@ -415,16 +416,16 @@ SYSTEM LIMITATIONS:
415
  - box/box-template.urdf (boxes)
416
  - pallet/pallet.urdf (pallets)
417
  - No custom assets can be created
418
- 3. **Workspace Bounds**: All objects must be within X: [0.25, 0.75], Y: [-0.5, 0.5], Z: [0, 0.3]
419
- 4. **Object Limits**: Recommended 5-20 objects per task. More than 30-50 objects may cause performance issues.
420
- 5. **Unsupported Actions**:
421
  - "Knock down" or "destroy" structures (can use "place near" or "push near" instead)
422
  - Cutting, breaking, or modifying objects
423
  - Throwing objects
424
  - Complex physics interactions beyond pick-place-push
425
  - Tasks requiring more than 25-30 steps
426
- 6. **Available Colors**: red, blue, green, yellow, orange, purple, brown (no custom colors)
427
- 7. **No Dynamic Object Creation**: All objects must be created at task initialization
428
 
429
  USER INPUT: "{user_input}"
430
 
 
402
  prompt = f"""You are a validation system for a robotic simulation framework. Your job is to check if a user's task request is feasible within the system's limitations.
403
 
404
  SYSTEM LIMITATIONS:
405
+ 1. **Language Support**: The system accepts input in ANY language (Portuguese, English, Spanish, etc.). The input will be automatically translated to the task format. DO NOT reject tasks based on language.
406
+ 2. **Available Primitives**: Only PickPlace (pick and place) and Push are available. No cutting, breaking, throwing, or destructive actions.
407
+ 3. **Available Assets**: Only these assets exist:
408
  - stacking/block.urdf (blocks)
409
  - stacking/ball.urdf (balls/spheres)
410
  - stacking/stand.urdf (stands/bases)
 
416
  - box/box-template.urdf (boxes)
417
  - pallet/pallet.urdf (pallets)
418
  - No custom assets can be created
419
+ 4. **Workspace Bounds**: All objects must be within X: [0.25, 0.75], Y: [-0.5, 0.5], Z: [0, 0.3]
420
+ 5. **Object Limits**: Recommended 5-20 objects per task. More than 30-50 objects may cause performance issues.
421
+ 6. **Unsupported Actions**:
422
  - "Knock down" or "destroy" structures (can use "place near" or "push near" instead)
423
  - Cutting, breaking, or modifying objects
424
  - Throwing objects
425
  - Complex physics interactions beyond pick-place-push
426
  - Tasks requiring more than 25-30 steps
427
+ 7. **Available Colors**: red, blue, green, yellow, orange, purple, brown (no custom colors)
428
+ 8. **No Dynamic Object Creation**: All objects must be created at task initialization
429
 
430
  USER INPUT: "{user_input}"
431