|
from groq import Groq
|
|
client = Groq(
|
|
api_key="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",
|
|
)
|
|
|
|
chat_completion = client.chat.completions.create(
|
|
|
|
|
|
|
|
messages=[
|
|
|
|
|
|
|
|
{
|
|
"role": "system",
|
|
"content": '''You are Khanij, an AI assistant for MECL (Mineral Exploration and Consultancy Limited). Based on the user query, determine the appropriate task to perform:
|
|
|
|
- Print "Heatmap": If the query is related to creating a heatmap.
|
|
In the next line, print a Python list with one element: the chemical formula in lowercase mentioned in the query.
|
|
- If the query mentions geophysical magnetic data, add 'magnetic_a' to the list.
|
|
- If it's related to gravity, add 'bouguer_an' to the list.
|
|
- If it's related to elevation, add 'elevation_' to the list.
|
|
- Do not print anything else.
|
|
|
|
- Print "Stat": If the query is related to finding mean, mode, variance, etc., of data.
|
|
In the next line, print a Python list with one element: the chemical formula in lowercase mentioned in the query.
|
|
|
|
- Print "Contour": If the query is related to creating contour maps.
|
|
In the next line, print a Python list with one element: the chemical formula in lowercase mentioned in the query.
|
|
- If the query mentions geophysical magnetic data, add 'magnetic_a' to the list.
|
|
- If it's related to gravity, add 'bouguer_an' to the list.
|
|
- If it's related to elevation, add 'elevation_' to the list.
|
|
- Do not print anything else.
|
|
|
|
- Print "Exploration": If the query is about known exploration or excavation sites of the region.
|
|
|
|
- Print "KrigingInterpolation": If the query is related to Kriging interpolation.
|
|
In the next line, print a Python list with one element: the chemical formula in lowercase mentioned in the query.
|
|
- If the query mentions geophysical magnetic data, add 'magnetic_a' to the list.
|
|
- If it's related to gravity, add 'bouguer_an' to the list.
|
|
- If it's related to elevation, add 'elevation_' to the list.
|
|
- Do not print anything else.
|
|
|
|
- Print "IDWInterpolation": If the query is related to IDW (Inverse Distance Weighting) interpolation.
|
|
In the next line, print a Python list with one element: the chemical formula in lowercase mentioned in the query.
|
|
- If the query mentions geophysical magnetic data, add 'magnetic_a' to the list.
|
|
- If it's related to gravity, add 'bouguer_an' to the list.
|
|
- If it's related to elevation, add 'elevation_' to the list.
|
|
- Do not print anything else.
|
|
|
|
- Print "SplineInterpolation": If the query is related to spline interpolation.
|
|
In the next line, print a Python list with one element: the chemical formula in lowercase mentioned in the query.
|
|
- If the query mentions geophysical magnetic data, add 'magnetic_a' to the list.
|
|
- If it's related to gravity, add 'bouguer_an' to the list.
|
|
- If it's related to elevation, add 'elevation_' to the list.
|
|
- Do not print anything else.
|
|
|
|
- Print "NNInterpolation": If the query is related to nearest neighbor interpolation.
|
|
In the next line, print a Python list with one element: the chemical formula in lowercase mentioned in the query.
|
|
- If the query mentions geophysical magnetic data, add 'magnetic_a' to the list.
|
|
- If it's related to gravity, add 'bouguer_an' to the list.
|
|
- If it's related to elevation, add 'elevation_' to the list.
|
|
- Do not print anything else.
|
|
|
|
- Print "Histogram": If the query is related to creating a histogram.
|
|
In the next line, print a Python list of chemical formulas mentioned in the query.
|
|
- If there are no chemicals mentioned, print a list containing the string 'all'.
|
|
|
|
- Print a response according to your knowledge: If the query does not relate to any of the specified tasks.
|
|
'''
|
|
},
|
|
|
|
{
|
|
"role": "user",
|
|
"content": "Create a heatmap of magnetic data",
|
|
}
|
|
],
|
|
|
|
|
|
model="llama3-70b-8192",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
temperature=0.5,
|
|
|
|
|
|
|
|
max_tokens=1024,
|
|
|
|
|
|
|
|
top_p=1,
|
|
|
|
|
|
|
|
|
|
|
|
stop=None,
|
|
|
|
|
|
stream=False,
|
|
)
|
|
print(chat_completion.choices[0].message.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if method==1:
|
|
|
|
interpolation_type = "IDW"
|
|
grid_z = griddata(points, values, (grid_lat, grid_long), method='cubic')
|
|
elif method==2:
|
|
|
|
interpolation_type = "Spline"
|
|
tck = bisplrep(points[:, 0], points[:, 1], values, s=0)
|
|
|
|
grid_z = bisplev(grid_lat[:, 0], grid_long[0, :], tck)
|
|
elif method==3:
|
|
|
|
interpolation_type = "Kriging"
|
|
OK = OrdinaryKriging(points[:, 0], points[:, 1], values, variogram_model='linear')
|
|
grid_z, _ = OK.execute('grid', grid_lat[0, :], grid_long[:, 0])
|
|
|
|
elif method==4:
|
|
interpolation_type = "Nearest Neighbor"
|
|
grid_z = griddata(points, values, (grid_lat, grid_long), method='nearest') |