deep-diver / hllama

hllama is a library which aims to provide a set of utility tools for large language models.

Home Page:https://deep-diver.github.io/hllama/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hllama

hllama == Harness LLaMA. hllama is a library which aims to provide a set of utility tools for large language models.

Install

$ pip install hllama

Usage

Test if JSON matches target structure

from hllama import json_utils

A = {"key1": str, "key2": {"key3": str, "key4": int, "key5": list}}
B = {"key1": "hello", "key2": {"key3": "world", "key4": 100, "key5": [1, 2, 3]}}

result = json_utils.match_structure(A, B)
assert result is True

Test if there is JSON part in a string

raw_string = "..."
result = json_utils.parse_json_snippet(raw_string)
assert isinstance(result, dict)
assert result is not None

About

hllama is a library which aims to provide a set of utility tools for large language models.

https://deep-diver.github.io/hllama/

License:Apache License 2.0


Languages

Language:Python 96.7%Language:Makefile 3.3%