AmineDiro / cria

OpenAI compatible API for serving LLAMA-2 model
MIT License
215 stars 13 forks source link

Chat #5

Closed AmineDiro closed 1 year ago

AmineDiro commented 1 year ago

Implemented chat/completions route no SSE. This completes the standard support for OpenAI interface.

Request:

{
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello!"
    },
    {
      "role": "assistant",
      "content": " Welcome, how can I be of assistance?\n"
    },
    {
      "role": "user",
      "content": "Can you tell me where is Morocco?"
    }
  ]
}

Response: llama-2-7b-chat

{
  "id": "cmpl-b8bfcf07-d9bf-4ed4-9464-1c9720a61d39",
  "object": "text_completion",
  "model": "Llama-2",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": " Of course! Morocco is a country located in North Africa. It borders the Mediterranean Sea to the north and the Atlantic Ocean to the west. The capital of Morocco is Rabat, and the official language is Arabic, with French and Berber also widely spoken. The country has a rich culture and history, including ancient cities like Marrakech and Fez, as well as beautiful beaches along its coastline. Is there anything else I can help you with?"
      },
      "finish_reason": "Length"
    }
  ],
  "usage": {
    "prompt_tokens": 50,
    "completion_tokens": 152,
    "total_tokens": 202
  }
}