```python
import json
import re
from pathlib import Path
def parse_markdown_to_sidebar(markdown_content):
lines = markdown_content.splitlines()
sidebar = []
current_category = None
current_subcategory = None
for line in lines:
if line.startswith('### '):
# Subcategory
if current_subcategory is not None:
current_category['items'].append(current_subcategory)
subcategory_title = line.strip('# ').strip()
current_subcategory = {
"type": "category",
"label": subcategory_title,
"collapsed": True,
"items": [],
"link": {"type": "generated-index"}
}
elif line.startswith('## '):
# Category
if current_category is not None:
if current_subcategory is not None:
current_category['items'].append(current_subcategory)
current_subcategory = None
sidebar.append(current_category)
category_title = line.strip('# ').strip()
current_category = {
"type": "category",
"label": category_title,
"collapsed": True,
"items": [],
"link": {"type": "generated-index"}
}
elif line.startswith('- ['):
# Link
match = re.match(r'- \[(.*?)\]\((.*?)\)', line)
if match:
title, link = match.groups()
link = link.replace('/docs/', '') # Remove '/docs/' prefix
if current_subcategory is not None:
current_subcategory['items'].append(link)
elif current_category is not None:
current_category['items'].append(link)
# Add the last category and subcategory if they exist
if current_subcategory is not None:
current_category['items'].append(current_subcategory)
if current_category is not None:
sidebar.append(current_category)
return sidebar
def generate_sidebar_json(file_path):
with open(file_path, 'r') as md_file:
markdown_content = md_file.read()
sidebar = parse_markdown_to_sidebar(markdown_content)
sidebar_json = json.dumps({"items": sidebar}, indent=2)
return sidebar_json
```
**Description**: ToolKit and Tools for accessing data in a Cassandra
Database primarily for Agent integration. Initially, this includes the
following tools:
- `cassandra_db_schema` Gathers all schema information for the connected
database or a specific schema. Critical for the agent when determining
actions.
- `cassandra_db_select_table_data` Selects data from a specific keyspace
and table. The agent can pass paramaters for a predicate and limits on
the number of returned records.
- `cassandra_db_query` Expiriemental alternative to
`cassandra_db_select_table_data` which takes a query string completely
formed by the agent instead of parameters. May be removed in future
versions.
Includes unit test and two notebooks to demonstrate usage.
**Dependencies**: cassio
**Twitter handle**: @PatrickMcFadin
---------
Co-authored-by: Phil Miesle <phil.miesle@datastax.com>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
**Description:** This pull request introduces a new feature to community
tools, enhancing its search capabilities by integrating the Mojeek
search engine
**Dependencies:** None
---------
Co-authored-by: Igor Brai <igor@mojeek.com>
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: ccurme <chester.curme@gmail.com>
Thank you for contributing to LangChain!
- [ ] **PR title**: "docs: switched GCSLoaders docs to
langchain-google-community"
- [ ] **PR message**: ***Delete this entire checklist*** and replace
with
- **Description:** switched GCSLoaders docs to
langchain-google-community
Implemented bind_tools for OllamaFunctions.
Made OllamaFunctions sub class of ChatOllama.
Implemented with_structured_output for OllamaFunctions.
integration unit test has been updated.
notebook has been updated.
---------
Co-authored-by: Bagatur <baskaryan@gmail.com>