Quincy Hsieh commited on
Commit
b818d09
·
1 Parent(s): 5f5e6b2

Fix error Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.

Browse files
Files changed (3) hide show
  1. README.md +2 -2
  2. app.py +2 -2
  3. config.json +6 -5
README.md CHANGED
@@ -173,7 +173,7 @@ headers = {"api-key": AZURE_API_KEY, "Content-Type": "application/json"}
173
  payload = {
174
  "model": "gpt-5",
175
  "messages": [{"role": "user", "content": prompt}],
176
- "max_tokens": 512,
177
  "temperature": 0.7,
178
  "top_p": 0.95,
179
  }
@@ -508,7 +508,7 @@ Then edit `data/config.json`:
508
  "llm": {
509
  "endpoint_url": "https://<your-resource>.openai.azure.com/openai/deployments/<your-deployment>/chat/completions?api-version=2024-12-01-preview",
510
  "model": "gpt-5",
511
- "max_tokens": 512,
512
  "temperature": 0.7,
513
  "top_p": 0.95
514
  }
 
173
  payload = {
174
  "model": "gpt-5",
175
  "messages": [{"role": "user", "content": prompt}],
176
+ "max_completion_tokens": 512,
177
  "temperature": 0.7,
178
  "top_p": 0.95,
179
  }
 
508
  "llm": {
509
  "endpoint_url": "https://<your-resource>.openai.azure.com/openai/deployments/<your-deployment>/chat/completions?api-version=2024-12-01-preview",
510
  "model": "gpt-5",
511
+ "max_completion_tokens": 512,
512
  "temperature": 0.7,
513
  "top_p": 0.95
514
  }
app.py CHANGED
@@ -75,7 +75,7 @@ EMBEDDING_MODEL_NAME = _config["embedding"]["model"]
75
  # LLM (Azure OpenAI)
76
  LLM_ENDPOINT_URL = _config["llm"]["endpoint_url"]
77
  LLM_MODEL_NAME = _config["llm"]["model"]
78
- LLM_MAX_TOKENS = _config["llm"].get("max_tokens", 512)
79
  LLM_TEMPERATURE = _config["llm"].get("temperature", 0.7)
80
  LLM_TOP_P = _config["llm"].get("top_p", 0.95)
81
 
@@ -270,7 +270,7 @@ def call_llm(prompt: str) -> str:
270
  payload = {
271
  "model": LLM_MODEL_NAME,
272
  "messages": [{"role": "user", "content": prompt}],
273
- "max_tokens": LLM_MAX_TOKENS,
274
  "temperature": LLM_TEMPERATURE,
275
  "top_p": LLM_TOP_P,
276
  }
 
75
  # LLM (Azure OpenAI)
76
  LLM_ENDPOINT_URL = _config["llm"]["endpoint_url"]
77
  LLM_MODEL_NAME = _config["llm"]["model"]
78
+ LLM_MAX_TOKENS = _config["llm"].get("max_completion_tokens", 512)
79
  LLM_TEMPERATURE = _config["llm"].get("temperature", 0.7)
80
  LLM_TOP_P = _config["llm"].get("top_p", 0.95)
81
 
 
270
  payload = {
271
  "model": LLM_MODEL_NAME,
272
  "messages": [{"role": "user", "content": prompt}],
273
+ "max_completion_tokens": LLM_MAX_TOKENS,
274
  "temperature": LLM_TEMPERATURE,
275
  "top_p": LLM_TOP_P,
276
  }
config.json CHANGED
@@ -1,13 +1,14 @@
1
  {
2
  "embedding": {
3
- "endpoint_url": "https://hackathon-eiffel-2026-apim.azure-api.net/ai/models/openai/deployments/text-embedding-3/embeddings?api-version=2024-12-01-preview",
4
- "model": "text-embedding-3"
5
  },
6
  "llm": {
7
- "endpoint_url": "https://hackathon-eiffel-2026-apim.azure-api.net/ai/models/openai/deployments/gpt-5/chat/completions?api-version=2024-12-01-preview",
8
- "model": "gpt-5",
9
- "max_tokens": 512,
10
  "temperature": 0.7,
11
  "top_p": 0.95
12
  }
 
13
  }
 
1
  {
2
  "embedding": {
3
+ "endpoint_url": "https://hackathon-eiffel-2026-apim.azure-api.net/ai/openai/deployments/text-embedding-3-small/embeddings?api-version=2024-12-01-preview",
4
+ "model": "text-embedding-3-small"
5
  },
6
  "llm": {
7
+ "endpoint_url": "https://hackathon-eiffel-2026-apim.azure-api.net/ai/openai/deployments/gpt-5.1/chat/completions?api-version=2024-12-01-preview",
8
+ "model": "gpt-5.1",
9
+ "max_completion_tokens": 512,
10
  "temperature": 0.7,
11
  "top_p": 0.95
12
  }
13
+
14
  }