GithubHelp home page GithubHelp logo

tugot17 / aleph-alpha-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aleph-alpha/aleph-alpha-client

0.0 0.0 0.0 630 KB

AA client for for introducing a change to the ImagePrompt class

License: MIT License

Shell 0.03% Python 99.97%

aleph-alpha-client's Introduction

Aleph Alpha Client

License PyPI version Documentation Status

Python client for the Aleph Alpha API.

Usage

Synchronous Client

import os
from aleph_alpha_client import Client, CompletionRequest, Prompt

client = Client(token=os.getenv("AA_TOKEN"))
request = CompletionRequest(
    prompt=Prompt.from_text("Provide a short description of AI:"),
    maximum_tokens=64,
)
response = client.complete(request, model="luminous-extended")

print(response.completions[0].completion)

Asynchronous Client

import os
from aleph_alpha_client import AsyncClient, CompletionRequest, Prompt

# Can enter context manager within an async function
async with AsyncClient(token=os.environ["AA_TOKEN"]) as client:
    request = CompletionRequest(
        prompt=Prompt.from_text("Provide a short description of AI:"),
        maximum_tokens=64,
    )
    response = await client.complete(request, model="luminous-base") 
    print(response.completions[0].completion)

Interactive Examples

This table contains interactive code examples, further exercises can be found in the examples repository.

Template Description Internal Link Colab Link
1 Calling the API Template 1 Open In Colab
2 Simple completion Template 2 Open In Colab
3 Simple search Template 3 Open In Colab
4 Symmetric and Asymmetric Search Template 4 Open In Colab
5 Hidden Embeddings Template 5 Open In Colab
6 Combining functionalities Template 6 Open In Colab

Installation

The latest stable version is deployed to PyPi so you can install this package via pip.

pip install aleph-alpha-client

Get started using the client by first creating an account. Afterwards head over to your profile to create an API token. Read more about how you can manage your API tokens here.

Links

aleph-alpha-client's People

Contributors

aasascha avatar ahartel avatar benbrandt avatar capsenz avatar ghost---shadow avatar jancen0 avatar jneuff avatar johannesha avatar nyxcode avatar pacman82 avatar sweinbach avatar testuser128379046 avatar volkerstampa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.