Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

LlamaAPI SDK

LlamaAPI is a Python SDK for interacting with the Llama API. It abstracts away the handling of aiohttp sessions and headers, allowing for a simplified interaction with the API.

Installation

You can install the LlamaAPI SDK using pip:

pip install llamaapi

Usage

After installing the SDK, you can use it in your Python projects like so:

from llamaapi import llamaapi

# Initialize the llamaapi with your api_token
llama = LlamaAPI('<your_api_token>')

# Define your API request
api_request_json = {
  "messages": [
    {"role": "user", "content": "What is the weather like in Boston?"},
  ],
  "functions": [
    {
      "name": "get_current_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
          "type": "object",
          "properties": {
              
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            },
            "days": {
              "type": "number",
              "description": "for how many days ahead you wants the forecast"
            },
            "unit": {
              "type": "string",
              "enum": ["celsius", "fahrenheit"]
            }
          }
      },
      "required": ["location", "days"]
    }
  ],
  "stream": True,
  "function_call": "get_current_weather"
}

# Make your request and handle the response
sequences = llama.run(api_request_json)
for seq in sequences:
    print(seq)

Note: The run function is asynchronous and will return when all the data from the server has been received.

Change Log

Version 0.1: Initial release

Contributing

We welcome contributions to this project. Please see the Contributing Guidelines for more details.

License

llamaapi SDK is licensed under the MIT License. Please see the License File for more details.

Metadata

Release files for apillama 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 apillama 0.1.5
File Size Uploaded
apillama-0.1.5.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for apillama 0.1.5
File Interpreter ABI Platform
apillama-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 6.4 kB

Release files / apillama-0.1.5.tar.gz

Download URL apillama-0.1.5.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e48bccf8fdda61efc2f5432cee263be761396e89fdcd1134d6e1b49e153b520c
BLAKE2b-256 checksum
How to use checksums
00681e9ce069fcf422ec1f9c6e0b7734c486fb44e0c1ab44c24923bbb20427b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.9.13 Linux/5.15.0-73-generic

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

Download URL apillama-0.1.5-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba4383222f728e81bec8cb2b3926f2fded0d0b2a44e6f78037af9c19d356c051
BLAKE2b-256 checksum
How to use checksums
7884c80f2864e6930475e79a7903e3a5c47719e2ad00ba1de7d677ad9af0fff9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.9.13 Linux/5.15.0-73-generic

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

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