nyx_extras.langchain¶
Optional module for tight integration between Nyx and LangChain.
Classes¶
An opinionated client wrapping langChain to evaluate user queries against contents of a Nyx network. |
Module Contents¶
- class nyx_extras.langchain.NyxLangChain(config=None, llm=None, log_level=logging.WARN, system_prompt=None)¶
Bases:
nyx_client.client.NyxClientAn opinionated client wrapping langChain to evaluate user queries against contents of a Nyx network.
This class extends NyxClient to provide LangChain-based functionality for querying Nyx network contents.
Note
The LLM must support tool calling.
- Parameters:
- query(query, data=None, include_own=False, sqlite_file=None)¶
Query the LLM with a user prompt and context from Nyx.
This method takes a user prompt and invokes it against the LLM associated with this instance, using context from Nyx.
- Parameters:
query (str) – The user input.
data (collections.abc.Sequence[nyx_client.data.Data] | None) – Sequence of data to use for context. If not specified, uses all subscribed data.
include_own (bool) – Include your own data, created in Nyx, in the query.
sqlite_file (str | None) – A file location to write the sql_lite file to.
update_subscribed) – if set to true this will re-poll Nyx for subscribed data
- Returns:
The answer from the LLM.
- Return type:
Note
If the data list is not provided, this method updates subscriptions and retrieves all subscribed data.