langchain/docs/modules/indexes/document_loaders/examples/toml.ipynb
Leonid Ganeline 59204a5033
docs: document_loaders improvements (#4200)
- made notebooks consistent: titles, service/format descriptions.
- corrected short names to full names, for example, `Word` -> `Microsoft
Word`
- added missed descriptions
- renamed notebook files to make ToC correctly sorted
2023-05-05 17:44:54 -07:00

97 lines
2.6 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "4284970b",
"metadata": {},
"source": [
"# TOML\n",
"\n",
">[TOML](https://en.wikipedia.org/wiki/TOML) is a file format for configuration files. It is intended to be easy to read and write, and is designed to map unambiguously to a dictionary. Its specification is open-source. `TOML` is implemented in many programming languages. The name `TOML` is an acronym for \"Tom's Obvious, Minimal Language\" referring to its creator, Tom Preston-Werner.\n",
"\n",
"If you need to load `Toml` files, use the `TomlLoader`."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "202fc42d",
"metadata": {},
"outputs": [],
"source": [
"from langchain.document_loaders import TomlLoader"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "7ecae98c",
"metadata": {},
"outputs": [],
"source": [
"loader = TomlLoader('example_data/fake_rule.toml')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "eb08c26e",
"metadata": {},
"outputs": [],
"source": [
"rule = loader.load()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "405d36bc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[Document(page_content='{\"internal\": {\"creation_date\": \"2023-05-01\", \"updated_date\": \"2022-05-01\", \"release\": [\"release_type\"], \"min_endpoint_version\": \"some_semantic_version\", \"os_list\": [\"operating_system_list\"]}, \"rule\": {\"uuid\": \"some_uuid\", \"name\": \"Fake Rule Name\", \"description\": \"Fake description of rule\", \"query\": \"process where process.name : \\\\\"somequery\\\\\"\\\\n\", \"threat\": [{\"framework\": \"MITRE ATT&CK\", \"tactic\": {\"name\": \"Execution\", \"id\": \"TA0002\", \"reference\": \"https://attack.mitre.org/tactics/TA0002/\"}}]}}', metadata={'source': 'example_data/fake_rule.toml'})]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rule"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a896454d",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}