Coder Social home page Coder Social logo

bd_llm_access's Introduction

This service is proudly brought to you by Bosch Digital_ Cross-Division Consulting and AI Model Serving Platform.

How access completion models?

For this years BCX Bosch Digital_ provides access to these completion models:

OpenAI Llama 2 Mistral.ai
gpt-3.5 Llama-7b Mistral-7b
gpt-4 Llama-70b

All models are provided as chat/instruct variants. For OpenAIs quota limits apply.

Using python the completion models can be queried in the following way:

import requests
import json

url = "https://llms.azurewebsites.net/chat/completions"

payload = json.dumps({
  "model": "MODEL_NAME (SEE TABLE)",
  "temperature": 0.5,
  "messages": [
    {
      "role": "user",
      "content": "YOUR_PROMPT"
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_API_KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

OR

import openai

client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://llms.azurewebsites.net"
)

response = client.chat.completions.create(model="MODEL_NAME (SEE TABLE)", messages = [
    {
        "role": "user",
        "content": "YOUR_PROMPT"
    }
])

print(response)

For OpenAI models, streaming output is also available:

import openai

client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://llms.azurewebsites.net"
)

response = client.chat.completions.create(model="MODEL_NAME (SEE TABLE)", messages = [
    {
        "role": "user",
        "content": "YOUR_PROMPT"
    }
],
stream=True)


for chunk in response:
    if chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="")

How access embedding models?

Via OpenAI's text-embedding-3-small you can embed your input text:


import requests
import json

url = "https://llms.azurewebsites.net/embeddings"

payload = json.dumps({
  "model": "text-embedding-3-small",
  "input": "YOUR_TEXT_TO_EMBED"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer YOUR_API_KEY'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

OR

from openai import OpenAI

client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://llms.azurewebsites.net"
)

response = client.embeddings.create(
    input="YOUR_TEXT_TO_EMBED",
    model="text-embedding-3-small"
)

print(response.data[0].embedding)

๐Ÿšจ Not satisfied, yet?

Function Calling, Whisper, GPT-Vision, custom GPU power for fine tuning or more credits needed? Hit us up via Slack or visited the Bosch Digital_ Booth at the Marketplace.

bd_llm_access's People

Contributors

maximilian-rost avatar m-gora avatar gbeister 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.