Skip to main content

langchain-nexa-ai

This package contains the LangChain integration with Nexa AI.

Installation

pip install -U langchain-nexa-ai

And you should get an api key from Nexa Hub and set it as an environment variable (NEXA_API_KEY)

LLMs

NexaAILLM class exposes Octopus LLMs from NexaAI. We currently support four catogories: shopping, conference, streaming, and travel. See our langchain-nexa-ai tutorial and Nexa AI documentation for more details!

from langchain_nexa_ai import NexaAILLM

octopus_llm = NexaAILLM()
result = octopus_llm.invoke("Show recommended products for electronics.", category="shopping")
print(result)

If NEXA_API_KEY is not set in env, you can also pass api_key as an argument when initializing:

octopus_llm = NexaAILLM(api_key=api_key)

You can also pass a list of catogories (corresponding to each of your prompts) when using generate method of NexaAILLM.

result = octopus_llm.generate(
    prompts=[
        "Show recommended products for electronics.",
        "Find a Hotel to stay in Toyko from June 1 to June 10."
    ],
    categories=[
        "shopping",
        "travel"
    ]
)

Exploit LCEL

from langchain_nexa_ai import NexaAILLM
from langchain_core.output_parsers import JsonOutputParser

octopus_llm = NexaAILLM()
parser = JsonOutputParser()

chain = octopus_llm | parser

result = chain.invoke(
    input="Show me recommended electronics products",
    config={
        "llms": {
            "NexaAILLM": {
                "categories": ["shopping"]
            }
        }
    }
)
print(result)

Chat Models

Coming soon.

TODO

  • streaming
  • docs

Metadata

Release files for langchain-nexa-ai 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-nexa-ai 0.1.5
File Size Uploaded Provenance Actions
langchain_nexa_ai-0.1.5.tar.gz 4.6 kB Without provenance Details for langchain_nexa_ai-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-nexa-ai 0.1.5
File Interpreter ABI Platform Actions
langchain_nexa_ai-0.1.5-py3-none-any.whl Python 3 none any Details for langchain_nexa_ai-0.1.5-py3-none-any.whl

Total release size: 9.4 kB

Release files / langchain_nexa_ai-0.1.5.tar.gz

Download URL langchain_nexa_ai-0.1.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8da5f176ac5e31fca55daa88ae9cebf8d05524fb3148c4d0ccaf5b085769089c
BLAKE2b-256 checksum
How to use checksums
ac8f55034ac87f19d2cc80ecdbb8b185acf05ad9a3b0f737e6bcd6484248d1c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Release files / langchain_nexa_ai-0.1.5-py3-none-any.whl

Download URL langchain_nexa_ai-0.1.5-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b32c2a2fc4c3bd998f2fb130b2627885f18a4899c206a84405687b9b43cfc3f
BLAKE2b-256 checksum
How to use checksums
8207a25107ad94779cc04852ee1711528bc17fb79356d546b7219c93cb3638e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Security for langchain-nexa-ai 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page