Find textual answers via an LLM.
Project description
LLMTextualAnswer
Python package for finding textual answers via LLMs. This is a Python port of the Wolfram Language LLMTextualAnswer function, focused on building prompts, wiring LangChain models, and parsing structured outputs.
Install
pip install LLMTextualAnswer
Usage
from LLMTextualAnswer import LLMTextualAnswer
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini")
text = (
"Born and raised in the Austrian Empire, Tesla studied engineering and physics "
"in the 1870s without receiving a degree."
)
questions = ["Where born?"]
result = LLMTextualAnswer(
text,
questions,
llm=llm,
form=dict,
)
print(result)
For more detailed examples see the notebook "./docs/Basic-usage.ipynb".
Notes
LLMTextualAnsweraccepts LangChain chat/text models that support.invoke.- Use
prompt_style="chat"orprompt_style="text"if auto-detection is not desired. - When you want only the prompt template, pass
form="StringTemplate".
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmtextualanswer-0.1.0.tar.gz.
File metadata
- Download URL: llmtextualanswer-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc4c21edf2e92ef04138c45cff251afdae80a34d8303f73252024c5a6cd3895c
|
|
| MD5 |
b66b366a3289a1444e6a4917a1784425
|
|
| BLAKE2b-256 |
514f59c6aeee579dd363235e17bc8cc6122c2e68da7e8768510ae9857bf86856
|
File details
Details for the file llmtextualanswer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llmtextualanswer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66c1e454b4ba30feb37b86fa069ba13df00f1e144357fcadfd8f02c4acfbc9e0
|
|
| MD5 |
e4892e585116f931697c33cc8a73e465
|
|
| BLAKE2b-256 |
c285763ff2b6bc8e36a1caf3f841e876fc6cfd03178bc5286fa4b362bea5e147
|