GenAI APIs provides a unified API callers to Gemini API, OpenAI API, and Anthropic API.
Project description
genai-apis
# openai, gemini, gemini-vertex, anthropic, anthropic-vertex, anthropic-bedrock
# !pip install genai-apis[openai]
kwargs = {
"api_key": "..."
"GCP_PROJECT_ID": "...",
"GCP_LOCATION": "...",
"AWS_LOCATION": "..."
}
extra_kwargs = {
...
stream=False
}
service = "openai"
model = "gpt-4-turbo-2024-04-09"
prompt = "Hello!!"
# openai,
# gemini, gemini-vertex,
# anthropic, anthropic-bedrock, anthropic-vertex
api_client = APIFactory.get_api_client(service, **kwargs)
result = await api_client.generate_text(model, prompt, **extra_kwargs)
print(result)
# for stream
async for chunk in result:
print(chunk, end='')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for genai_apis-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b81231312f5f77407a694380bcf6d7301a23ed51318e71d6f5a73196f8730e24 |
|
MD5 | aeca1869875a72aeca7183eb3c9afbc5 |
|
BLAKE2b-256 | 8f463f4e2f2c37234e6999977fdcd56539c1a5dfbfd779ba0d84d4bd780afbec |