mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 11:39:18 +00:00
docs, standard-tests: how to standard test a custom tool, imports (#27931)
This commit is contained in:
@@ -24,6 +24,16 @@ class EscapePreprocessor(Preprocessor):
|
||||
# escape ``` in code
|
||||
cell.source = cell.source.replace("```", r"\`\`\`")
|
||||
# escape ``` in output
|
||||
|
||||
# allow overriding title based on comment at beginning of cell
|
||||
if cell.source.startswith("# title="):
|
||||
lines = cell.source.split("\n")
|
||||
title = lines[0].split("# title=")[1]
|
||||
if title.startswith('"') and title.endswith('"'):
|
||||
title = title[1:-1]
|
||||
cell.metadata["title"] = title
|
||||
cell.source = "\n".join(lines[1:])
|
||||
|
||||
if "outputs" in cell:
|
||||
filter_out = set()
|
||||
for i, output in enumerate(cell["outputs"]):
|
||||
|
@@ -1,5 +1,20 @@
|
||||
{% extends 'markdown/index.md.j2' %}
|
||||
|
||||
{% block input %}
|
||||
```
|
||||
{%- if 'magics_language' in cell.metadata -%}
|
||||
{{ cell.metadata.magics_language}}
|
||||
{%- elif 'name' in nb.metadata.get('language_info', {}) -%}
|
||||
{{ nb.metadata.language_info.name }}
|
||||
{%- endif %}
|
||||
{%- if 'title' in cell.metadata -%}
|
||||
{{ ' ' }}title="{{ cell.metadata.title }}"
|
||||
|
||||
{%- endif %}
|
||||
{{ cell.source}}
|
||||
```
|
||||
{% endblock input %}
|
||||
|
||||
{%- block traceback_line -%}
|
||||
```output
|
||||
{{ line.rstrip() | strip_ansi }}
|
||||
|
Reference in New Issue
Block a user