shivrajkarewar commited on
Commit
3aeec2f
·
verified ·
1 Parent(s): ce80c98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -17,15 +17,7 @@ headers = {"Authorization": f"Bearer {groq_api_key}"}
17
 
18
  # Function to interact with Groq API
19
  def get_material_info(user_input):
20
- prompt = f"""You are a materials science expert. A user is asking for applications of materials.
21
- Based on the user's request: "{user_input}", identify the 3 best materials for this application.
22
- For each material, provide:
23
- - Material Name:
24
- - Key Properties relevant to the application: (e.g., strength, conductivity, melting point) with values if possible.
25
- - A brief explanation of why this material is suitable for the application.
26
- - A simplified representation of its atomic structure (if readily available and can be described textually, e.g., "FCC lattice", "HCP lattice", or a simple chemical formula with a basic structural description).
27
-
28
- Format your response as a JSON object with the following structure:
29
  ```json
30
  {
31
  "materials": [
@@ -63,6 +55,17 @@ def get_material_info(user_input):
63
  }
64
  ```
65
  """
 
 
 
 
 
 
 
 
 
 
 
66
  body = {
67
  "model": "llama-3.1-8b-instant",
68
  "messages": [{"role": "user", "content": prompt}]
 
17
 
18
  # Function to interact with Groq API
19
  def get_material_info(user_input):
20
+ json_format = """
 
 
 
 
 
 
 
 
21
  ```json
22
  {
23
  "materials": [
 
55
  }
56
  ```
57
  """
58
+ prompt = f"""You are a materials science expert. A user is asking for applications of materials.
59
+ Based on the user's request: "{user_input}", identify the 3 best materials for this application.
60
+ For each material, provide:
61
+ - Material Name:
62
+ - Key Properties relevant to the application: (e.g., strength, conductivity, melting point) with values if possible.
63
+ - A brief explanation of why this material is suitable for the application.
64
+ - A simplified representation of its atomic structure (if readily available and can be described textually, e.g., "FCC lattice", "HCP lattice", or a simple chemical formula with a basic structural description).
65
+
66
+ Format your response as a JSON object with the following structure:
67
+ {json_format}
68
+ """
69
  body = {
70
  "model": "llama-3.1-8b-instant",
71
  "messages": [{"role": "user", "content": prompt}]