DavidNgoue commited on
Commit
02ccea1
·
verified ·
1 Parent(s): 20dca57

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +109 -44
src/streamlit_app.py CHANGED
@@ -23,14 +23,21 @@ import uuid
23
  logging.basicConfig(level=logging.INFO)
24
  logger = logging.getLogger("langsmith")
25
 
 
 
 
 
 
 
 
26
  # Load environment variables
27
  load_dotenv()
28
 
29
  # ========== LangSmith Configuration ==========
30
- def configure_langsmith(tracing_enabled=True):
31
  """Configure LangSmith environment variables."""
32
  os.environ["LANGSMITH_ENDPOINT"] = "https://api.smith.langchain.com"
33
- os.environ["LANGSMITH_API_KEY"] = os.getenv("LANGSMITH_API_KEY", "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")
34
  os.environ["LANGSMITH_PROJECT"] = "multi-ia-app"
35
  os.environ["LANGSMITH_TRACING"] = "true" if tracing_enabled else "false"
36
  logger.info(f"LangSmith tracing {'enabled' if tracing_enabled else 'disabled'}")
@@ -46,6 +53,23 @@ def initialize_langsmith_client():
46
  st.error(f"Erreur lors de l'initialisation de LangSmith : {str(e)}")
47
  return None
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  # --------- UTILS for Lottie ---------
50
  def load_lottieurl(url: str):
51
  r = requests.get(url)
@@ -266,7 +290,7 @@ with st.sidebar:
266
  def save_api_key(groq_api_key, langsmith_api_key, tracing_enabled=True):
267
  config_dir = Path(".config")
268
  config_dir.mkdir(exist_ok=True)
269
- config_file = "config.json"
270
 
271
  config = {
272
  "groq_api_key": groq_api_key,
@@ -275,15 +299,15 @@ def save_api_key(groq_api_key, langsmith_api_key, tracing_enabled=True):
275
  }
276
  with open(config_file, "w") as f:
277
  json.dump(config, f)
278
- configure_langsmith(tracing_enabled)
279
 
280
  def load_api_key():
281
- config_file = Path("config.json")
282
  if config_file.exists():
283
  with open(config_file, "r") as f:
284
  config = json.load(f)
285
- return config.get("groq_api_key"), config.get("langsmith_api_key"), config.get("tracing_enabled", True)
286
- return None, None, True
287
 
288
  # ---------- API Key Setup Interface ----------
289
  def show_api_key_setup():
@@ -360,8 +384,8 @@ def show_api_key_setup():
360
 
361
  st.markdown("""
362
  <div class="api-setup">
363
- <h1>🔑 Configuration des API</h1>
364
- <p>Pour utiliser toutes les fonctionnalités de Multi-IA, veuillez configurer vos clés API.</p>
365
  </div>
366
  """, unsafe_allow_html=True)
367
 
@@ -375,13 +399,14 @@ def show_api_key_setup():
375
  groq_api_key = st.text_input(
376
  "Clé API Groq",
377
  type="password",
378
- help="Entrez votre clé API Groq pour activer la génération de texte avancée"
379
  )
380
 
381
- # LangSmith API Section
382
  st.markdown("""
383
  <div class="api-section">
384
  <h3>📊 API LangSmith</h3>
 
385
  </div>
386
  """, unsafe_allow_html=True)
387
 
@@ -389,7 +414,7 @@ def show_api_key_setup():
389
  "Clé API LangSmith",
390
  type="password",
391
  value="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",
392
- help="Entrez votre clé API LangSmith pour activer le monitoring"
393
  )
394
 
395
  # Tracing toggle
@@ -398,24 +423,28 @@ def show_api_key_setup():
398
  col1, col2 = st.columns([1, 2])
399
  with col1:
400
  if st.button("��� Sauvegarder", use_container_width=True):
401
- if groq_api_key and langsmith_api_key:
402
- save_api_key(groq_api_key, langsmith_api_key, tracing_enabled)
403
- st.success("Clés API sauvegardées avec succès ! Traçage " + ("activé" if tracing_enabled else "désactivé"))
404
- st.rerun()
 
 
 
 
 
405
  else:
406
- st.error("Veuillez entrer toutes les clés API requises")
407
 
408
  with col2:
409
  st.markdown("""
410
  <div class="api-info">
411
- <p>🔍 Comment obtenir vos clés API :</p>
412
- <h4>Groq API :</h4>
413
  <ol>
414
  <li>Créez un compte sur <a href="https://console.groq.com" target="_blank">console.groq.com</a></li>
415
  <li>Accédez à la section "API Keys"</li>
416
  <li>Générez une nouvelle clé API</li>
417
  </ol>
418
- <h4>LangSmith API :</h4>
419
  <ol>
420
  <li>Créez un compte sur <a href="https://smith.langchain.com" target="_blank">smith.langchain.com</a></li>
421
  <li>Accédez à vos paramètres</li>
@@ -458,7 +487,7 @@ def initialize_clients(groq_api_key, langsmith_api_key):
458
  return True
459
  except Exception as e:
460
  logger.error(f"Failed to initialize clients: {str(e)}")
461
- st.error(f"Erreur lors de l'initialisation des clients: {str(e)}")
462
  return False
463
 
464
  # ---------- Test Tracing Function ----------
@@ -488,9 +517,16 @@ def generate_text_with_groq(prompt, length, temperature=1.0):
488
  return result
489
  except Exception as e:
490
  logger.error(f"Groq error: {str(e)}")
491
- st.error(f"Erreur Groq: {str(e)}")
492
  return None
493
 
 
 
 
 
 
 
 
494
  @traceable(run_type="chain", name="translation", tags=["translation", "helsinki-nlp"])
495
  def translate(text, src_lang, tgt_lang):
496
  global langsmith_client
@@ -498,7 +534,19 @@ def translate(text, src_lang, tgt_lang):
498
  logger.error("LangSmith client not initialized")
499
  st.error("Le client LangSmith n'est pas initialisé. Veuillez configurer vos clés API.")
500
  return None
501
-
 
 
 
 
 
 
 
 
 
 
 
 
502
  try:
503
  model_name = f"Helsinki-NLP/opus-mt-{src_lang}-{tgt_lang}"
504
  translator = pipeline("translation", model=model_name)
@@ -507,7 +555,7 @@ def translate(text, src_lang, tgt_lang):
507
  return result
508
  except Exception as e:
509
  logger.error(f"Translation error: {str(e)}")
510
- st.error(f"Erreur de traduction: {str(e)}")
511
  return None
512
 
513
  @traceable(run_type="chain", name="text_to_speech", tags=["tts", "mms-tts"])
@@ -520,6 +568,7 @@ def text_to_speech(text, model, tokenizer):
520
 
521
  if model is None or tokenizer is None:
522
  logger.error("TTS model or tokenizer is None")
 
523
  return None
524
  try:
525
  inputs = tokenizer(text, return_tensors="pt")
@@ -534,7 +583,7 @@ def text_to_speech(text, model, tokenizer):
534
  return audio_file.read()
535
  except Exception as e:
536
  logger.error(f"TTS error: {str(e)}")
537
- st.error(f"Erreur TTS: {str(e)}")
538
  return None
539
 
540
  # ========== Modern LangSmith Monitoring Badge ==========
@@ -590,19 +639,28 @@ def main():
590
 
591
  # Load API keys and tracing setting
592
  groq_api_key, langsmith_api_key, tracing_enabled = load_api_key()
593
- configure_langsmith(tracing_enabled)
594
 
595
- # Display LangSmith status badge
596
- display_langsmith_badge(tracing_enabled)
597
-
598
- # Check if API keys are configured
599
- if not groq_api_key or not langsmith_api_key:
600
  show_api_key_setup()
601
  return
 
 
 
 
 
 
 
 
 
 
 
 
602
 
603
  # Initialize clients with the saved API keys
604
  if not initialize_clients(groq_api_key, langsmith_api_key):
605
- st.error("Impossible d'initialiser les clients API. Veuillez vérifier vos clés API.")
606
  return
607
 
608
  # Set up LangChain environment
@@ -699,13 +757,13 @@ def main():
699
  gen_btn = st.button("✨ Générer le texte", key="modern-gen-btn")
700
  if gen_btn:
701
  with st.spinner("Génération en cours..."):
702
- st_lottie(loading_animation, height=80, key="loading-text-gen")
703
  texte = generate_text_with_groq(prompt, length, temperature)
704
  if texte:
705
  st.markdown(f"""
706
- <div class='fade-in-card' style='background: linear-gradient(120deg, #fafdff 60%, #fbc2eb 100%); border-radius: 28px; box-shadow: 0 4px 24px #a18cd122; padding: 2rem 1.5rem; margin-top:1.5em; max-width:700px; margin-left:auto; margin-right:auto;'>
707
  <span class='ia-badge'>🤖 Réponse IA</span>
708
- <div style='font-size:1.18em; color:#222; margin:1em 0 0.5em 0;'>{texte}</div>
709
  <button class='copy-btn' onclick="navigator.clipboard.writeText(`{texte}`)">Copier</button>
710
  </div>
711
  """, unsafe_allow_html=True)
@@ -797,19 +855,21 @@ def main():
797
  tgt = st.selectbox("Langue cible :", list(langues.keys()), index=1)
798
 
799
  if langues[src] == langues[tgt]:
800
- st.warning("La langue source et la langue cible doivent être différentes.")
 
 
801
  else:
802
  texte_input = st.text_area("Texte à traduire :",
803
- placeholder="Ex : Wie schön ist das Wetter heute?")
804
 
805
  if st.button("📤 Traduire"):
806
  with st.spinner("Traduction en cours..."):
807
  result = translate(texte_input, langues[src], langues[tgt])
808
  if result:
809
- st.markdown(f"<div class='block'><p><strong>{src.capitalize()} :</strong> {texte_input}</p></div>",
810
- unsafe_allow_html=True)
811
- st.markdown(f"<div class='block'><p><strong>{tgt.capitalize()} :</strong> <span class='translated-text'>{result}</span></p></div>",
812
- unsafe_allow_html=True)
813
  else:
814
  st.error("Erreur lors de la traduction ou modèle non disponible.")
815
 
@@ -858,11 +918,11 @@ def main():
858
  <span class='badge'>Pandas</span>
859
  <span class='badge'>Plotly</span>
860
  <span class='badge'>SQL</span>
861
- <h3 style='color:#4b79a1; margin-top:1.5em;'>Projets Récents</h3>
862
  <ul>
863
  <li><b>💳 Credit Card Expenditure Predictor</b> : Application de prédiction de dépenses de carte de crédit.</li>
864
  <li><b>🫀 HeartGuard AI</b> : Prédiction de risques cardiaques par IA.</li>
865
- <li><b>🔊 Multi-IA</b> : Plateforme multi-modèles pour la génération de texte, synthèse vocale et traduction.</li>
866
  </ul>
867
  </div>
868
  """, unsafe_allow_html=True)
@@ -880,6 +940,11 @@ def main():
880
  </div>
881
  """, unsafe_allow_html=True)
882
 
 
 
 
 
 
883
  # Tracing settings
884
  st.markdown("### Configuration du traçage")
885
  new_tracing_enabled = st.checkbox("Activer le traçage LangSmith", value=tracing_enabled)
@@ -892,7 +957,7 @@ def main():
892
  # Test tracing
893
  st.markdown("### Tester le traçage")
894
  test_input = st.text_input("Entrez un texte pour tester le traçage", key="test-tracing-input")
895
- if st.button("Tester le traçage"):
896
  result = test_tracing_function(test_input)
897
  st.write(result)
898
  st.info("Vérifiez votre projet LangSmith (multi-ia-app) pour voir la trace !")
 
23
  logging.basicConfig(level=logging.INFO)
24
  logger = logging.getLogger("langsmith")
25
 
26
+ # Vérification de sentencepiece au démarrage
27
+ try:
28
+ import sentencepiece
29
+ except ImportError:
30
+ st.error("La bibliothèque 'sentencepiece' est requise pour la traduction. Installez-la avec `pip install sentencepiece` et redémarrez l'application.")
31
+ st.stop()
32
+
33
  # Load environment variables
34
  load_dotenv()
35
 
36
  # ========== LangSmith Configuration ==========
37
+ def configure_langsmith(tracing_enabled=True, langsmith_api_key=None):
38
  """Configure LangSmith environment variables."""
39
  os.environ["LANGSMITH_ENDPOINT"] = "https://api.smith.langchain.com"
40
+ os.environ["LANGSMITH_API_KEY"] = langsmith_api_key or os.getenv("LANGSMITH_API_KEY", "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")
41
  os.environ["LANGSMITH_PROJECT"] = "multi-ia-app"
42
  os.environ["LANGSMITH_TRACING"] = "true" if tracing_enabled else "false"
43
  logger.info(f"LangSmith tracing {'enabled' if tracing_enabled else 'disabled'}")
 
53
  st.error(f"Erreur lors de l'initialisation de LangSmith : {str(e)}")
54
  return None
55
 
56
+ # Validate API key (only Groq)
57
+ def validate_api_key(groq_api_key):
58
+ """Validate Groq API key by attempting to initialize client."""
59
+ try:
60
+ groq_client = Groq(api_key=groq_api_key)
61
+ # Test a simple request to validate Groq API key
62
+ groq_client.chat.completions.create(
63
+ messages=[{"role": "user", "content": "Test"}],
64
+ model="llama-3.3-70b-versatile",
65
+ max_tokens=10
66
+ )
67
+ logger.info("Groq API key validated successfully")
68
+ return True, "Clé API Groq valide"
69
+ except Exception as e:
70
+ logger.error(f"Invalid Groq API key: {str(e)}")
71
+ return False, f"Clé API Groq invalide : {str(e)}"
72
+
73
  # --------- UTILS for Lottie ---------
74
  def load_lottieurl(url: str):
75
  r = requests.get(url)
 
290
  def save_api_key(groq_api_key, langsmith_api_key, tracing_enabled=True):
291
  config_dir = Path(".config")
292
  config_dir.mkdir(exist_ok=True)
293
+ config_file = config_dir / "config.json"
294
 
295
  config = {
296
  "groq_api_key": groq_api_key,
 
299
  }
300
  with open(config_file, "w") as f:
301
  json.dump(config, f)
302
+ configure_langsmith(tracing_enabled, langsmith_api_key)
303
 
304
  def load_api_key():
305
+ config_file = Path(".config/config.json")
306
  if config_file.exists():
307
  with open(config_file, "r") as f:
308
  config = json.load(f)
309
+ return config.get("groq_api_key"), config.get("langsmith_api_key", "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"), config.get("tracing_enabled", True)
310
+ return None, "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", True
311
 
312
  # ---------- API Key Setup Interface ----------
313
  def show_api_key_setup():
 
384
 
385
  st.markdown("""
386
  <div class="api-setup">
387
+ <h1>🔑 Configuration de l'API Groq</h1>
388
+ <p>Pour utiliser toutes les fonctionnalités de Multi-IA, veuillez configurer votre clé API Groq.</p>
389
  </div>
390
  """, unsafe_allow_html=True)
391
 
 
399
  groq_api_key = st.text_input(
400
  "Clé API Groq",
401
  type="password",
402
+ help="Entrez votre clé API Groq pour activer la génération de texte avancée. Obtenez-la sur https://console.groq.com."
403
  )
404
 
405
+ # LangSmith API Section (préremplie)
406
  st.markdown("""
407
  <div class="api-section">
408
  <h3>📊 API LangSmith</h3>
409
+ <p>La clé LangSmith par défaut est utilisée pour le monitoring. Vous pouvez la modifier si nécessaire.</p>
410
  </div>
411
  """, unsafe_allow_html=True)
412
 
 
414
  "Clé API LangSmith",
415
  type="password",
416
  value="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",
417
+ help="Clé API LangSmith pour le monitoring. La clé par défaut est préremplie."
418
  )
419
 
420
  # Tracing toggle
 
423
  col1, col2 = st.columns([1, 2])
424
  with col1:
425
  if st.button("��� Sauvegarder", use_container_width=True):
426
+ if groq_api_key:
427
+ # Valider la clé Groq avant de sauvegarder
428
+ is_valid, message = validate_api_key(groq_api_key)
429
+ if is_valid:
430
+ save_api_key(groq_api_key, langsmith_api_key, tracing_enabled)
431
+ st.success("Clé API Groq sauvegardée avec succès ! Traçage " + ("activé" if tracing_enabled else "désactivé"))
432
+ st.rerun()
433
+ else:
434
+ st.error(message)
435
  else:
436
+ st.error("Veuillez entrer une clé API Groq")
437
 
438
  with col2:
439
  st.markdown("""
440
  <div class="api-info">
441
+ <p>🔍 Comment obtenir votre clé API Groq :</p>
 
442
  <ol>
443
  <li>Créez un compte sur <a href="https://console.groq.com" target="_blank">console.groq.com</a></li>
444
  <li>Accédez à la section "API Keys"</li>
445
  <li>Générez une nouvelle clé API</li>
446
  </ol>
447
+ <p>🔍 La clé LangSmith par défaut est utilisée pour le monitoring. Pour une clé personnalisée :</p>
448
  <ol>
449
  <li>Créez un compte sur <a href="https://smith.langchain.com" target="_blank">smith.langchain.com</a></li>
450
  <li>Accédez à vos paramètres</li>
 
487
  return True
488
  except Exception as e:
489
  logger.error(f"Failed to initialize clients: {str(e)}")
490
+ st.error(f"Erreur lors de l'initialisation des clients : {str(e)}")
491
  return False
492
 
493
  # ---------- Test Tracing Function ----------
 
517
  return result
518
  except Exception as e:
519
  logger.error(f"Groq error: {str(e)}")
520
+ st.error(f"Erreur Groq : {str(e)}")
521
  return None
522
 
523
+ # Liste des paires de langues supportées
524
+ SUPPORTED_LANGUAGE_PAIRS = {
525
+ ("en", "fr"), ("fr", "en"), ("en", "es"), ("es", "en"),
526
+ ("de", "en"), ("en", "de"), ("it", "en"), ("en", "it"),
527
+ ("nl", "en"), ("en", "nl"), ("pt", "en"), ("en", "pt")
528
+ }
529
+
530
  @traceable(run_type="chain", name="translation", tags=["translation", "helsinki-nlp"])
531
  def translate(text, src_lang, tgt_lang):
532
  global langsmith_client
 
534
  logger.error("LangSmith client not initialized")
535
  st.error("Le client LangSmith n'est pas initialisé. Veuillez configurer vos clés API.")
536
  return None
537
+
538
+ if (src_lang, tgt_lang) not in SUPPORTED_LANGUAGE_PAIRS:
539
+ logger.error(f"Unsupported language pair: {src_lang} -> {tgt_lang}")
540
+ st.error(f"La paire de langues {src_lang} -> {tgt_lang} n'est pas supportée.")
541
+ return None
542
+
543
+ try:
544
+ import sentencepiece
545
+ except ImportError:
546
+ logger.error("sentencepiece is not installed")
547
+ st.error("La bibliothèque 'sentencepiece' est requise pour la traduction. Installez-la avec `pip install sentencepiece`.")
548
+ return None
549
+
550
  try:
551
  model_name = f"Helsinki-NLP/opus-mt-{src_lang}-{tgt_lang}"
552
  translator = pipeline("translation", model=model_name)
 
555
  return result
556
  except Exception as e:
557
  logger.error(f"Translation error: {str(e)}")
558
+ st.error(f"Erreur de traduction : {str(e)}. Vérifiez que le modèle {model_name} est disponible.")
559
  return None
560
 
561
  @traceable(run_type="chain", name="text_to_speech", tags=["tts", "mms-tts"])
 
568
 
569
  if model is None or tokenizer is None:
570
  logger.error("TTS model or tokenizer is None")
571
+ st.error("Modèle TTS non chargé correctement.")
572
  return None
573
  try:
574
  inputs = tokenizer(text, return_tensors="pt")
 
583
  return audio_file.read()
584
  except Exception as e:
585
  logger.error(f"TTS error: {str(e)}")
586
+ st.error(f"Erreur TTS : {str(e)}")
587
  return None
588
 
589
  # ========== Modern LangSmith Monitoring Badge ==========
 
639
 
640
  # Load API keys and tracing setting
641
  groq_api_key, langsmith_api_key, tracing_enabled = load_api_key()
 
642
 
643
+ # Vérifier si la clé API Groq est présente et valide
644
+ if not groq_api_key:
645
+ st.warning("Une clé API Groq est requise pour utiliser l'application.")
 
 
646
  show_api_key_setup()
647
  return
648
+
649
+ # Valider la clé Groq
650
+ is_valid, message = validate_api_key(groq_api_key)
651
+ if not is_valid:
652
+ st.error(message)
653
+ show_api_key_setup()
654
+ return
655
+
656
+ configure_langsmith(tracing_enabled, langsmith_api_key)
657
+
658
+ # Display LangSmith status badge
659
+ display_langsmith_badge(tracing_enabled)
660
 
661
  # Initialize clients with the saved API keys
662
  if not initialize_clients(groq_api_key, langsmith_api_key):
663
+ st.error("Impossible d'initialiser les clients API. Veuillez vérifier votre clé API Groq.")
664
  return
665
 
666
  # Set up LangChain environment
 
757
  gen_btn = st.button("✨ Générer le texte", key="modern-gen-btn")
758
  if gen_btn:
759
  with st.spinner("Génération en cours..."):
760
+ st_lottie(loading_animation, height=80, key="loading-textgen")
761
  texte = generate_text_with_groq(prompt, length, temperature)
762
  if texte:
763
  st.markdown(f"""
764
+ <div class='fade-in-card' style='background: linear-gradient(120deg, #fafdff 60%, #fbc2eb 100); border-radius: 28px; box-shadow: 0 4px 24px #a18cd122; padding: 2rem 1.5rem; margin-top:1.5em; max-width:767px; margin-left:auto; margin-right:;'>
765
  <span class='ia-badge'>🤖 Réponse IA</span>
766
+ <div style='font-size:1.18em; color:#222; margin: 1em 0 0.5em 0;'>{texte}</div>
767
  <button class='copy-btn' onclick="navigator.clipboard.writeText(`{texte}`)">Copier</button>
768
  </div>
769
  """, unsafe_allow_html=True)
 
855
  tgt = st.selectbox("Langue cible :", list(langues.keys()), index=1)
856
 
857
  if langues[src] == langues[tgt]:
858
+ st.error("La langue source et la langue cible doivent être différentes.")
859
+ elif (langues[src], langues[tgt]) not in SUPPORTED_LANGUAGE_PAIRS:
860
+ st.warning(f"La paire de langues {src} -> {tgt} n'est pas supportée.")
861
  else:
862
  texte_input = st.text_area("Texte à traduire :",
863
+ placeholder="Exemple : Wie schön ist das Wetter heute ?")
864
 
865
  if st.button("📤 Traduire"):
866
  with st.spinner("Traduction en cours..."):
867
  result = translate(texte_input, langues[src], langues[tgt])
868
  if result:
869
+ st.markdown(f"<div class='block'><p><strong>{src.capitalize()}</strong> : {texte_input}</p></div>",
870
+ unsafe_allow_html=True)
871
+ st.markdown(f"<div class='block'><p><strong>{tgt.capitalize()}</strong> : <span class='translated-text'>{result}</span></p></div>",
872
+ unsafe_allow_html=True)
873
  else:
874
  st.error("Erreur lors de la traduction ou modèle non disponible.")
875
 
 
918
  <span class='badge'>Pandas</span>
919
  <span class='badge'>Plotly</span>
920
  <span class='badge'>SQL</span>
921
+ <h3 style='color:#4b79a1; margin-top:1.5em;'>Projets récents</h3>
922
  <ul>
923
  <li><b>💳 Credit Card Expenditure Predictor</b> : Application de prédiction de dépenses de carte de crédit.</li>
924
  <li><b>🫀 HeartGuard AI</b> : Prédiction de risques cardiaques par IA.</li>
925
+ <li><b>🔍 Multi-IA</b> : Plateforme multi-modèles pour la génération de texte, synthèse vocale et traduction.</li>
926
  </ul>
927
  </div>
928
  """, unsafe_allow_html=True)
 
940
  </div>
941
  """, unsafe_allow_html=True)
942
 
943
+ # API Key settings
944
+ st.markdown("### Configuration de la clé API Groq")
945
+ if st.button("Modifier la clé API Groq"):
946
+ show_api_key_setup()
947
+
948
  # Tracing settings
949
  st.markdown("### Configuration du traçage")
950
  new_tracing_enabled = st.checkbox("Activer le traçage LangSmith", value=tracing_enabled)
 
957
  # Test tracing
958
  st.markdown("### Tester le traçage")
959
  test_input = st.text_input("Entrez un texte pour tester le traçage", key="test-tracing-input")
960
+ if st.button("Tester"):
961
  result = test_tracing_function(test_input)
962
  st.write(result)
963
  st.info("Vérifiez votre projet LangSmith (multi-ia-app) pour voir la trace !")