llmcomp 1.2.3__py3-none-any.whl → 1.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -431,28 +431,14 @@ class FinetuningManager:
431
431
  return cls._org_cache[api_key]
432
432
 
433
433
  client = openai.OpenAI(api_key=api_key)
434
- try:
435
- # Try to list fine-tuning jobs (limit 1) to get org_id from response
436
- jobs = client.fine_tuning.jobs.list(limit=1)
437
- if jobs.data:
438
- org_id = jobs.data[0].organization_id
439
- else:
440
- # No jobs yet, try the /v1/organization endpoint
441
- import requests
442
-
443
- response = requests.get(
444
- "https://api.openai.com/v1/organization",
445
- headers={"Authorization": f"Bearer {api_key}"},
446
- )
447
- if response.status_code == 200:
448
- org_id = response.json().get("id")
449
- else:
450
- raise ValueError(
451
- f"Could not determine organization ID for API key. "
452
- f"API returned status {response.status_code}"
453
- )
454
- except Exception as e:
455
- raise ValueError(f"Could not determine organization ID: {e}")
434
+
435
+ # Try to list fine-tuning jobs (limit 1) to get org_id from response
436
+ jobs = client.fine_tuning.jobs.list(limit=1)
437
+ if jobs.data:
438
+ org_id = jobs.data[0].organization_id
439
+ else:
440
+ # There's no way to get the organization ID from the API key alone.
441
+ raise ValueError("First finetuning job in a new project must be created manually. See https://github.com/johny-b/llmcomp/issues/42.")
456
442
 
457
443
  cls._org_cache[api_key] = org_id
458
444
  return org_id
@@ -79,8 +79,13 @@ class ModelAdapter:
79
79
 
80
80
  if cls._is_reasoning_model(model):
81
81
  # Reasoning models need max_completion_tokens and reasoning_effort
82
- params["max_completion_tokens"] = 16
83
- params["reasoning_effort"] = "none"
82
+ params["max_completion_tokens"] = 32
83
+ if model.startswith("o"):
84
+ reasoning_effort = "low"
85
+ else:
86
+ reasoning_effort = "none"
87
+
88
+ params["reasoning_effort"] = reasoning_effort
84
89
  else:
85
90
  params["max_tokens"] = 1
86
91
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llmcomp
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: Research library for black-box experiments on language models.
5
5
  Project-URL: Homepage, https://github.com/johny-b/llmcomp
6
6
  Project-URL: Repository, https://github.com/johny-b/llmcomp
@@ -78,10 +78,11 @@ Examples 1-4 demonstrate all key functionalities of llmcomp.
78
78
  | 7 | [tinker.py](examples/tinker.py) | Using Tinker models via OpenAI-compatible API. |
79
79
  | 8 | [openrouter.py](examples/openrouter.py) | Using OpenRouter models via OpenAI-Compatible API. |
80
80
  | 9 | [model_adapter.py](examples/model_adapter.py) | Setting model-specific API parameters |
81
- | 10 | [x_mod_57.py](examples/x_mod_57.py) | Complete script I used for a short blogpost. |
82
81
  | 11 | [runner.py](examples/runner.py) | Direct Runner usage for low-level API interactions. |
83
82
  | 12 | [create_finetuning_job.py](examples/create_finetuning_job.py) | Create an OpenAI [finetuning](#finetuning) job & manage models. |
83
+ | 13 | [emergent misalignment replication](https://github.com/emergent-misalignment/emergent-misalignment/blob/main/evaluation/evaluate_openai.py) | Complete script replicating results from a paper |
84
84
  | 13 | [old bird names replication](https://github.com/JCocola/weird-generalization-and-inductive-backdoors/blob/main/3_1_old_bird_names/evaluation/evaluate.py) | Complete script replicating results from a paper |
85
+ | 14 | [x_mod_57.py](examples/x_mod_57.py) | Complete script I used for a short blogpost. |
85
86
 
86
87
  ## Model provider configuration
87
88
 
@@ -97,7 +98,7 @@ You can interfere with this process:
97
98
  ```
98
99
  from llmcomp import Config
99
100
 
100
- # See all pairs based on the env variables
101
+ # See all pairs read from the env variables
101
102
  print(Config.url_key_pairs)
102
103
 
103
104
  # Get the OpenAI client instance for a given model.
@@ -106,10 +107,10 @@ print(client.base_url, client.api_key[:16] + "...")
106
107
 
107
108
  # Set the pairs to whatever you want.
108
109
  # You can add other OpenAI-compatible providers, or e.g. local inference.
109
- Config.url_key_pairs = [("http://localhost:8000/v1", "fake-key")]
110
+ Config.url_key_pairs = [("http://localhost:8000/v1", "fake-key", "FAKE_API_KEY")]
110
111
  ```
111
112
 
112
- This has an unintended consequence: llmcomp sends some nonsensical requests. E.g. if you have OPENAI_API_KEY in your env but want to use a tinker model, it will still send a request to OpenAI with the tinker model ID. This is easy to improve, but also doesn't seem important.
113
+ This provider discovery process has an unintended consequence: llmcomp sends some nonsensical requests. E.g. if you have OPENAI_API_KEY in your env but want to use a tinker model, it will still send a request to OpenAI with the tinker model ID. This is easy to improve, but also doesn't seem important.
113
114
 
114
115
  ## API reference
115
116
 
@@ -3,17 +3,17 @@ llmcomp/config.py,sha256=xADWhqsQphJZQvf7WemWencmWuBnvTN_KeJrjWfnmHY,8942
3
3
  llmcomp/default_adapters.py,sha256=txs6NUOwGttC8jUahaRsoPCTbE5riBE7yKdAGPvKRhM,2578
4
4
  llmcomp/utils.py,sha256=8-jakxvwbMqfDkelE9ZY1q8Fo538Y_ryRv6PizRhHR0,2683
5
5
  llmcomp/finetuning/__init__.py,sha256=UEdwtJNVVqWjhrxvLvRLW4W4xjkKKwOR-GRkDxCP2Qo,58
6
- llmcomp/finetuning/manager.py,sha256=JaILoQYkNA9jIM_WR9eZactFHHcNFVeQeObXjQS8KcI,18779
6
+ llmcomp/finetuning/manager.py,sha256=6U5oQkOL_aGclFyhlQduTUhx4i7rjk6TLI3OtgA8L_o,18257
7
7
  llmcomp/finetuning/update_jobs.py,sha256=blsHzg_ViTa2hBJtWCqR5onttehTtmXn3vmCTNd_hJw,980
8
8
  llmcomp/question/judge.py,sha256=ovlEVp4XfgMc_qxYc4M7eq5qS-7C_WLjJklsO9wfU34,6105
9
9
  llmcomp/question/plots.py,sha256=2uZTSN1s7Y3pnx2jiGtfUdWfQt2812Oo-eDsO2ZTUlE,9617
10
10
  llmcomp/question/question.py,sha256=2CvE0xePLnD5SUJsE_ZyvAIE_36rjjW37fUqG3NHTV0,39171
11
11
  llmcomp/question/result.py,sha256=EcgXV-CbLNAQ1Bu0p-0QcjtrwBDt1WxSINwYuMmWoGs,8216
12
12
  llmcomp/runner/chat_completion.py,sha256=iDiWE0N0_MYfggD-ouyfUPyaADt7602K5Wo16a7JJo4,967
13
- llmcomp/runner/model_adapter.py,sha256=xBf6_WZbwKKTctecATujX9ZKQLDetDh-7UeCGaXJ9Zc,3244
13
+ llmcomp/runner/model_adapter.py,sha256=Dua98E7aBVrCaZ2Ep44vl164oFkpH1P78YqImQkns4U,3406
14
14
  llmcomp/runner/runner.py,sha256=C_SQ8pVGaGO57_4B85PMYWyntznsJnIwUOwnH3zP7IA,11494
15
- llmcomp-1.2.3.dist-info/METADATA,sha256=NJ4ZqfAZo0SC5n1gfSKmPxAFjujTzRWlvkaeBrfUdg8,12518
16
- llmcomp-1.2.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
- llmcomp-1.2.3.dist-info/entry_points.txt,sha256=1aoN8_W9LDUnX7OIOX7ACmzNkbBMJ6GqNn_A1KUKjQc,76
18
- llmcomp-1.2.3.dist-info/licenses/LICENSE,sha256=z7WR2X27WF_wZNuzfNFNlkt9cU7eFwP_3-qx7RyrGK4,1064
19
- llmcomp-1.2.3.dist-info/RECORD,,
15
+ llmcomp-1.2.4.dist-info/METADATA,sha256=TN_1IckuzHBhHnObNRHwOFHZKEqfA2F6cR1KJzjazoI,12762
16
+ llmcomp-1.2.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
+ llmcomp-1.2.4.dist-info/entry_points.txt,sha256=1aoN8_W9LDUnX7OIOX7ACmzNkbBMJ6GqNn_A1KUKjQc,76
18
+ llmcomp-1.2.4.dist-info/licenses/LICENSE,sha256=z7WR2X27WF_wZNuzfNFNlkt9cU7eFwP_3-qx7RyrGK4,1064
19
+ llmcomp-1.2.4.dist-info/RECORD,,