llm-edge / hal-9100

Edge full-stack LLM platform. Written in Rust
MIT License
372 stars 30 forks source link

[feat] create_and_run #94

Open AkshatGiri opened 9 months ago

AkshatGiri commented 9 months ago

Calling client.beta.threads.create_and_run errors out with the following invalid character: expected an optional prefix ofurn:uuid:followed by [0-9a-fA-F-], foundrat 1%

Same error with a direct curl

curl URL/threads/runs \
  -H "Authorization: Bearer EMPTY" \
  -H "Content-Type: application/json" \
  -H "OpenAI-Beta: assistants=v1" \
  -d '{
      "assistant_id": "ASSISTANT_ID",
      "thread": {
        "messages": [
          {"role": "user", "content": "Explain deep learning to a 5 year old."}
        ]
      }
    }'

To Reproduce


client = OpenAI(
    api_key="EMPTY",
    base_url=HAL-9100-URL,
)

# Create an assistant 
neil_assistant = client.beta.assistants.create(
    instructions="You are Neil Degrasse Tyson.",
    name="Neil Degrasse Tyson",
    tools=[],
    model="mistral/mixtral-8x7b-instruct",
)

# Call create_and_run
client.beta.threads.create_and_run(assistant_id=neil_assistant.id, thread={"messages": [{"role": "user", "content": "Can you explain the concept of black holes like I'm 5?"}]})

Expected behavior Should create a thread and run it. OpenAI docs - https://platform.openai.com/docs/api-reference/runs/createThreadAndRun

louis030195 commented 9 months ago

This endpoint is not implemented yet