Giter VIP home page Giter VIP logo

openembeddings's Introduction

Arguflow

Usage-based pricing to use bge-large-en model privately to create embeddings on your data

Arguflow OpenEmbedings: Pay for what use using ETH, USDC/USDT/DAI, or WBTC on Ethereum mainnet to privately encode your data into embeddings using bge-large-en (other models coming soon).

Search DemoDebate Opponent DemoDiscord

Arguflow OpenEmbeddings

Pricing per 1k-tokens by embedding model

Model USDC/USDT/DAI per 1k-tokens ETH per 1k-tokens WBTC per 1k-tokens
bge-large-en 0.00015 0.000000083 0.000000006

How to use

cURL via REST API

1. Get your API key

curl https://embeddings.arguflow.ai/key

Expected response will contain a key in the following format: EMB-09250e7c54e226d30ac3ee06f290c934

2. Get a payment address for your API key

Replace {key} with the key you received in the previous step

curl https://embeddings.arguflow.ai/gateway/{key}

Expected response will contain a valid Ethereum address

3. Use your wallet of choice to send ETH, USDC/USDT/DAI, or WBTC

4. Check your balance

curl https://embeddings.arguflow.ai/balance/{key}

5. Start making embedding vectors

curl -X POST https://embeddings.arguflow.ai/encode -H "Content-Type: application/json" -d '{
  "model": "bge-large-en",
  "input": "foo foo bar bar foo foo xyz",
  "key": "{key}"
}'

Python Wrapper

We made a very simple python wrapper of our api if you prefer that Look in examples/starter_notebook.ipynb to see a quick starter notebook or

import requests
import json

def create_api_key():
    response = requests.get("https://embeddings.arguflow.ai/key")
    return json.loads(response.text)["key"]

class OpenEmbeddingsClient:

    def __init__(self, api_key: str):
        if not api_key:
            raise ValueError("API key is required")

        self.api_key = api_key

    def create_payment_address(self):
        response = requests.get(f"https://embeddings.arguflow.ai/gateway/{self.api_key}")
        return json.loads(response.text)["address"]

    def get_balance(self):
        response = requests.get(f"https://embeddings.arguflow.ai/balance/{self.api_key}")
        return json.loads(response.text)["balance"]
    
    def create_embedding(self, input: str, model="bge-large-en"):
        if model != "bge-large-en":
            raise ValueError("Only bge-large-en is supported at the moment")
            
        req_json = {
            "model": model,
            "input": input,
            "key": self.api_key,
        }

        response = requests.post(f"https://embeddings.arguflow.ai/encode", json=req_json)

        if response.status_code == requests.codes.ok:
            return json.loads(response.text)["embeddings"]

    def get_key(self):
        return self.api_key

if __name__ == "__main__":
    api_key = create_api_key()
    # Save this key, it is the only way to access your account
    print(api_key)
    client = OpenEmbeddingsClient(api_key)
    # Send funds to this address
    # We accept ETH, USDC, wBTC and DAI, all other payment methods
    # are not supported and we have no way to detect
    print(client.create_payment_address()) 

    # Your balance in number of tokens. we keep it simple and have 
    # 1 token be exactly 4 charcters rounded up to the nearest amount
    print(client.get_balance())

    embedding = client.create_embedding("Make an embedding for this address", model="bge-large-en")

openembeddings's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

openembeddings's Issues

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.