sin30 commited on
Commit
872e627
·
verified ·
1 Parent(s): c708cff

Upload mongo.py

Browse files
Files changed (1) hide show
  1. mongo.py +14 -0
mongo.py CHANGED
@@ -13,6 +13,20 @@ def get_mongo_col(col="config_beta"):
13
  # 拿到 collection 对象
14
  collection = get_mongo_col() # 默认 col="config_beta"
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  query = {"name": "txt2txt_price_config"}
18
  projection = {"_id": 0, "data": 1}
 
13
  # 拿到 collection 对象
14
  collection = get_mongo_col() # 默认 col="config_beta"
15
 
16
+ service_name = "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
17
+ service_data = {
18
+ "completion_price": 0.015,
19
+ "prompt_price": 0.003,
20
+ "currency": "$"
21
+ }
22
+
23
+ result = collection.update_one(
24
+ {"name": "txt2txt_price_config"},
25
+ {"$set": {f"data.{service_name}": service_data}}
26
+ )
27
+
28
+ print(f"matched={result.matched_count}, modified={result.modified_count}")
29
+
30
 
31
  query = {"name": "txt2txt_price_config"}
32
  projection = {"_id": 0, "data": 1}