@@ -10,70 +10,24 @@ apiAuth:
1010 publicKey : none
1111 algorithm : RS256
1212
13- # This is only necessary until `openai-mock` supports text embeddings
14- sidecars :
15- - name : openai-mocker
16- image : python:3.11-alpine
17- imagePullPolicy : IfNotPresent
18- command :
19- - /bin/sh
20- - -ce
21- - |-
22- cat > /tmp/embeddings-mock.py << 'EOF'
23- import uvicorn
24- from fastapi import FastAPI
25- from pydantic import BaseModel
26- from typing import List, Union
27- import random
28-
29- app = FastAPI()
30-
31- class EmbeddingRequest(BaseModel):
32- input: Union[str, List[str]]
33- model: str = "text-embedding-3-small"
34-
35- @app.post("/v1/embeddings")
36- async def create_embeddings(request: EmbeddingRequest):
37- inputs = request.input if isinstance(request.input, list) else [request.input]
38- embeddings = []
39- for i, text in enumerate(inputs):
40- embedding = [random.uniform(-1, 1) for _ in range(1536)]
41- embeddings.append({
42- "object": "embedding",
43- "index": i,
44- "embedding": embedding
45- })
46- return {
47- "object": "list",
48- "data": embeddings,
49- "model": request.model,
50- "usage": {
51- "prompt_tokens": sum(len(text.split()) for text in inputs),
52- "total_tokens": sum(len(text.split()) for text in inputs)
53- }
54- }
55-
56- if __name__ == "__main__":
57- uvicorn.run(app, host="0.0.0.0", port=8080)
58- EOF
59-
60- pip install fastapi uvicorn && python /tmp/embeddings-mock.py
6113
6214config :
6315 serviceConfiguration :
6416 version : ' 1'
6517 aiServices :
6618 chat :
6719 provider :
68- name : ' openai-compat'
69- baseUrl : ' https://api.openai-mock.com'
70- model : ' gpt-4'
20+ name : " mock"
21+ fakeResponses :
22+ - " Hello! This is a mock response for testing."
23+ - " Mock provider is working correctly."
24+ - " Test response from AIA mock provider."
25+ model : " mock-chat-model"
7126 textEmbeddings :
7227 provider :
73- name : ' openai-compat'
74- # `openai-mock` does not yet support text embeddings
75- baseUrl : ' http://localhost:8080/v1'
76- model : ' text-embedding-3-small'
28+ name : " mock"
29+ fakeResponses : []
30+ model : " mock-embedding-model"
7731 documentEngine :
7832 enabled : true
7933 url : http://document-engine:5000
0 commit comments