langchain/templates/llama2-functions
David Duong d39b4b61b6
Batch apply poetry lock --no-update for all templates (#12531)
Ran the following bash script for all templates

```bash
#!/bin/bash

set -e
current_dir="$(pwd)"
for directory in */; do
    if [ -d "$directory" ]; then
        (cd "$directory" && poetry lock --no-update)
    fi
done

cd "$current_dir"
```

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-10-30 15:18:53 -07:00
..
llama2_functions Minor template cleaning (#12573) 2023-10-30 11:27:44 -07:00
tests LLaMA2 with JSON schema support template (#12435) 2023-10-27 10:34:00 -07:00
llama2-functions.ipynb Formatting on ntbks (#12576) 2023-10-30 11:32:31 -07:00
poetry.lock Batch apply poetry lock --no-update for all templates (#12531) 2023-10-30 15:18:53 -07:00
pyproject.toml LLaMA2 with JSON schema support template (#12435) 2023-10-27 10:34:00 -07:00
README.md Minor template cleaning (#12573) 2023-10-30 11:27:44 -07:00

Extraction with LLaMA2 Function Calling

This template shows how to do extraction of structured data from unstructured data, using LLaMA2 fine-tuned for grammars and jsonschema.

Query transformations are one great application area for open source, private LLMs:

  • The tasks are often narrow and well-defined (e.g., generatae multiple questions from a user input)
  • They also are tasks that users may want to run locally (e.g., in a RAG workflow)

Specify the scehma you want to extract in chain.py

LLM

This template will use a Replicate hosted version of LLaMA2 that has support for grammars and jsonschema.

Based on the Replicate example, the JSON schema is supplied directly in the prompt.

Be sure that REPLICATE_API_TOKEN is set in your environment.