langchain-wiproai
Wipro AI integration for LangChain, providing seamless access to Wipro AI models with full tool calling support.
Installation
pip install langchain-wiproai
Quick Start
from langchain_wiproai import ChatWiproAI
# Initialize the model
llm = ChatWiproAI(
api_token="your-api-token",
model_name="gpt-4o",
temperature=0.0
)
# Simple usage
response = llm.invoke("Hello, how are you?")
print(response.content)
# With tool calling
from langchain_core.tools import tool
@tool
def get_weather(location: str) -> str:
\"\"\"Get the weather for a location.\"\"\"
return f"The weather in {location} is sunny!"
llm_with_tools = llm.bind_tools([get_weather])
response = llm_with_tools.invoke("What's the weather in Paris?")
print(response.tool_calls)
Configuration
Environment Variables
You can set your API token as an environment variable:
export WIPROAI_API_TOKEN="your-api-token"
Then use without passing the token:
from langchain_wiproai import ChatWiproAI
llm = ChatWiproAI() # Will use WIPROAI_API_TOKEN from environment
Parameters
api_token(str): Your Wipro AI API tokenapi_url(str): API endpoint URL (default: Wipro AI endpoint)model_name(str): Model to use (default: "gpt-4o")temperature(float): Temperature for generation (default: 0.0, range: 0.0-2.0)max_output_tokens(int): Maximum tokens to generate (default: 2000)top_p(float): Top-p sampling parameter (default: 1.0, range: 0.0-1.0)top_k(int): Top-k sampling parameter (default: 1)
Advanced Usage
Streaming
for chunk in llm.stream("Tell me a story"):
print(chunk.content, end="", flush=True)
Async
import asyncio
async def main():
response = await llm.ainvoke("Hello!")
print(response.content)
asyncio.run(main())
With LangChain Agents
from langchain.agents import create_react_agent
from langchain_wiproai import ChatWiproAI
from langchain_core.tools import tool
@tool
def calculator(expression: str) -> str:
\"\"\"Calculate a mathematical expression.\"\"\"
return str(eval(expression))
llm = ChatWiproAI(temperature=0)
agent = create_react_agent(llm, [calculator])
result = agent.invoke({"input": "What is 25 * 47?"})
Features
- ✅ Full LangChain integration
- ✅ Tool/function calling support
- ✅ Streaming support
- ✅ Async support
- ✅ Automatic JSON tool call parsing
- ✅ Multiple response format handling
- ✅ Pydantic v2 compatibility
Metadata
Release files for langchain-wiproai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_wiproai-0.1.0.tar.gz | 9.5 kB | Without provenance | Details for langchain_wiproai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_wiproai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_wiproai-0.1.0-py3-none-any.whl |
Total release size: 16.8 kB
Release files / langchain_wiproai-0.1.0.tar.gz
| Download URL | langchain_wiproai-0.1.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6075ad558fc242294502caafd89fce5b8e0bf738e670183b19f06c872256a34
|
|
BLAKE2b-256 checksum How to use checksums |
30445ce0961bdd1f20f57ad9a83556f590353841e6eb2fda6ff7f3309bfdb307
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / langchain_wiproai-0.1.0-py3-none-any.whl
| Download URL | langchain_wiproai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6861d03e0ea40288fa556e3ce059a5b52fd4ad737479397c3ea9ca679e378f73
|
|
BLAKE2b-256 checksum How to use checksums |
01eb72b7b6ec34ae81c21392535ff20086927cace15d86a015de721cd72d7e8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for langchain-wiproai 0.1.0
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.