neurotrace.core.utils
¶
neurotrace.core.utils
¶
load_prompt(name)
¶
Load a prompt file from the prompts directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the prompt file (without .md) |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Prompt text |
Source code in neurotrace/core/utils.py
safe_json_loads(json_string, return_type=dict)
¶
Safely load a JSON string, returning an empty dictionary on failure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
json_string
|
str
|
The JSON string to load. |
required |
Returns:
Type | Description |
---|---|
type
|
param json_string: |
type
|
param return_type: |
Source code in neurotrace/core/utils.py
strip_json_code_block(text)
¶
Strip code block formatting from a JSON string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The input text containing a JSON code block. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The cleaned JSON string without code block formatting. |