Prompt (LLM) Tool Test
This sample code demonstrates how you can use aidputils to test your prompt tool.
from aidputils.agents.tools import utils
from aidputils.agents.auth.util import auth_utils
tool_conf = {
'prompt_template': 'What is the capital of {country}',
'llm': {
'model_id': 'cohere.command-r-08-2024',
'model_provider': 'cohere',
'model_args': {
'temperature': 1,
'max_tokens': 600,
'frequency_penalty': 0,
'presence_penalty': 0,
'top_k': 0,
'top_p': 0.75
},
'compartment_id': '<your-compartment-ocid>',
'auth_type': 'REMOTE',
'endpoint': 'https://inference.generativeai.<oci-region>.oci.oraclecloud.com',
'auth_profile': 'DEFAULT'
}
}
runtime_params = {'country': 'India'}
context_vars = {'datalake_id': 'YOUR_DATALAKE_ID'}
try:
tool_result = utils.call_tool_by_class('PromptTool', tool_conf, runtime_params, **context_vars)
print(tool_result)
except Exception as e:
print(f"PromptTool execution failed: {e}")