You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

models.go 20 kB

1 year ago
1 year ago
6 months ago
6 months ago
6 months ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. package schsdk
  2. import (
  3. "gitlink.org.cn/cloudream/common/pkgs/types"
  4. cdssdk "gitlink.org.cn/cloudream/common/sdks/storage"
  5. "gitlink.org.cn/cloudream/common/utils/serder"
  6. )
  7. const (
  8. JobTypeNormal = "Normal"
  9. JobTypePCM = "PCM"
  10. JobTypeResource = "Resource"
  11. JobTypeInstance = "Instance"
  12. JobTypeFinetuning = "Finetuning"
  13. JobTypeDataPreprocess = "DataPreprocess"
  14. JobTypeDataReturn = "DataReturn"
  15. FileInfoTypePackage = "Package"
  16. FileInfoTypeLocalFile = "LocalFile"
  17. FileInfoTypeResource = "Resource"
  18. FileInfoTypeImage = "Image"
  19. FILE = "file"
  20. FOLDER = "folder"
  21. MemoryUtilization = "MemoryUtilization"
  22. GPUUtilization = "GPUUtilization"
  23. CPUUtilization = "CPUUtilization"
  24. MethodPost = "post"
  25. MethodGet = "get"
  26. CodeSuccess = 200
  27. )
  28. type JobID string
  29. type JobSetID string
  30. type DataID int64
  31. type ImageID int64
  32. // 计算中心ID
  33. type CCID int64
  34. type ModelID string
  35. type ModelName string
  36. type ECSInstanceID string
  37. type NodeID int64
  38. type Address string
  39. type ClusterID string
  40. type JobSetInfo struct {
  41. Jobs []JobInfo `json:"jobs"`
  42. }
  43. type JobInfo interface {
  44. GetLocalJobID() string
  45. GetTargetLocalJobIDs() []string
  46. SetTargetLocalJob(info TargetJobInfo)
  47. GetTargetInputParams(targetID string) map[string]string
  48. }
  49. var JobInfoTypeUnion = types.NewTypeUnion[JobInfo](
  50. (*NormalJobInfo)(nil),
  51. (*DataReturnJobInfo)(nil),
  52. (*MultiInstanceJobInfo)(nil),
  53. (*InstanceJobInfo)(nil),
  54. (*UpdateMultiInstanceJobInfo)(nil),
  55. (*FinetuningJobInfo)(nil),
  56. (*DataPreprocessJobInfo)(nil),
  57. (*AIJobInfo)(nil),
  58. (*HPCJobInfo)(nil),
  59. (*BindingJobInfo)(nil),
  60. (*PCMInferenceJobInfo)(nil),
  61. (*CompleteJobInfo)(nil),
  62. (*StartJobInfo)(nil),
  63. (*NotifyJobInfo)(nil),
  64. (*StopInferenceJobInfo)(nil),
  65. (*UploadJobInfo)(nil),
  66. )
  67. var _ = serder.UseTypeUnionInternallyTagged(&JobInfoTypeUnion, "type")
  68. type JobInfoBase struct {
  69. LocalJobID string `json:"localJobID"`
  70. TargetJob []TargetJobInfo `json:"targetJob"`
  71. }
  72. type TargetJobInfo struct {
  73. TargetJobID string `json:"targetJobID"`
  74. InputParams map[string]string `json:"inputParams"`
  75. }
  76. func (i *JobInfoBase) GetLocalJobID() string {
  77. return i.LocalJobID
  78. }
  79. func (i *JobInfoBase) GetTargetInputParams(targetID string) map[string]string {
  80. for _, v := range i.TargetJob {
  81. if v.TargetJobID == targetID {
  82. return v.InputParams
  83. }
  84. }
  85. return nil
  86. }
  87. func (i *JobInfoBase) GetTargetLocalJobIDs() []string {
  88. var IDs []string
  89. for _, v := range i.TargetJob {
  90. IDs = append(IDs, v.TargetJobID)
  91. }
  92. return IDs
  93. }
  94. func (i *JobInfoBase) SetTargetLocalJob(info TargetJobInfo) {
  95. for _, target := range i.TargetJob {
  96. // 已经存在,则不用再添加
  97. if target.TargetJobID == info.TargetJobID {
  98. return
  99. }
  100. }
  101. i.TargetJob = append(i.TargetJob, info)
  102. }
  103. type NormalJobInfo struct {
  104. serder.Metadata `union:"Normal"`
  105. JobInfoBase
  106. Type string `json:"type"`
  107. Files JobFilesInfo `json:"files"`
  108. Runtime JobRuntimeInfo `json:"runtime"`
  109. Resources JobResourcesInfo `json:"resources"`
  110. Services JobServicesInfo `json:"services"`
  111. ModelJobInfo ModelJobInfo `json:"modelJobInfo"`
  112. }
  113. type PCMInferenceJobInfo struct {
  114. serder.Metadata `union:"PCM_Inference"`
  115. JobInfoBase
  116. Type string `json:"type"`
  117. Name string `json:"name"`
  118. Description string `json:"description"`
  119. Files JobFilesInfo `json:"files"`
  120. JobResources JobResources `json:"jobResources"`
  121. BindingID DataID `json:"bindingID"`
  122. ResourceChoice ResourceChoice `json:"resourceChoice"`
  123. }
  124. type StopInferenceJobInfo struct {
  125. serder.Metadata `union:"StopInference"`
  126. JobInfoBase
  127. Type string `json:"type"`
  128. Url string `json:"url"`
  129. }
  130. type AIJobInfo struct {
  131. serder.Metadata `union:"AI"`
  132. JobInfoBase
  133. Type string `json:"type"`
  134. Name string `json:"name"`
  135. Description string `json:"description"`
  136. Files JobFilesInfo `json:"files"`
  137. JobResources JobResources `json:"jobResources"`
  138. ResourceChoice ResourceChoice `json:"resourceChoice"`
  139. }
  140. type CompleteJobInfo struct {
  141. serder.Metadata `union:"Complete"`
  142. JobInfoBase
  143. Type string `json:"type"`
  144. }
  145. type StartJobInfo struct {
  146. serder.Metadata `union:"Start"`
  147. JobInfoBase
  148. Type string `json:"type"`
  149. }
  150. type UploadJobInfo struct {
  151. serder.Metadata `union:"Upload"`
  152. JobInfoBase
  153. Type string `json:"type"`
  154. DataType string `json:"dataType"`
  155. }
  156. type NotifyJobInfo struct {
  157. serder.Metadata `union:"Notify"`
  158. JobInfoBase
  159. Type string `json:"type"`
  160. RequestType string `json:"requestType"`
  161. Url string `json:"url"`
  162. Body any `json:"body"`
  163. Headers map[string]string `json:"headers"`
  164. }
  165. type ResourceChoice struct {
  166. Type string `json:"type"`
  167. ResourceScopes []ResourceScope `json:"resourceScopes"`
  168. }
  169. type ResourceScope struct {
  170. Name string `json:"name"`
  171. Min float64 `json:"min"`
  172. Max float64 `json:"max"`
  173. }
  174. type BindingJobInfo struct {
  175. serder.Metadata `union:"Binding"`
  176. JobInfoBase
  177. Type string `json:"type"`
  178. Info DataBinding `json:"info"`
  179. Name string `json:"name"` // 临时使用
  180. }
  181. type DataBinding interface {
  182. Noop()
  183. }
  184. var DataBindingTypeUnion = types.NewTypeUnion[DataBinding](
  185. (*ModelBinding)(nil),
  186. (*DatasetBinding)(nil),
  187. )
  188. var _ = serder.UseTypeUnionInternallyTagged(&DataBindingTypeUnion, "type")
  189. type DataBindingBase struct{}
  190. func (d *DataBindingBase) Noop() {}
  191. type ModelBinding struct {
  192. serder.Metadata `union:"model"`
  193. DataBindingBase
  194. Type string `json:"type"`
  195. Name string `json:"name"`
  196. Description string `json:"description"`
  197. ClusterIDs []ClusterID `json:"clusterIDs"`
  198. Category string `json:"category"`
  199. ModelType string `json:"modelType"`
  200. Env string `json:"env"`
  201. Version string `json:"version"`
  202. RepositoryName string `json:"repositoryName"`
  203. }
  204. type DatasetBinding struct {
  205. serder.Metadata `union:"dataset"`
  206. DataBindingBase
  207. Type string `json:"type"`
  208. Name string `json:"name"`
  209. OperateType string `json:"operateType"`
  210. ClusterIDs []ClusterID `json:"clusterIDs"`
  211. Description string `json:"description"`
  212. Category string `json:"category"`
  213. PackageID cdssdk.PackageID `json:"packageID"`
  214. RepositoryName string `json:"repositoryName"`
  215. ConsumptionPoints int64 `json:"points"`
  216. }
  217. type HPCJobInfo struct {
  218. serder.Metadata `union:"HPC"`
  219. JobInfoBase
  220. Type string `json:"type"`
  221. Name string `json:"name"`
  222. Description string `json:"description"`
  223. ClusterID ClusterID `json:"clusterID"`
  224. Backend string `json:"backend"`
  225. App string `json:"app"`
  226. OperateType string `json:"operateType"`
  227. ScriptContent string `json:"scriptContent"`
  228. Parameters HPCParameter `json:"parameters"`
  229. }
  230. type HPCParameter struct {
  231. JobName string `json:"jobName"`
  232. JobDir string `json:"jobDir"`
  233. Partition string `json:"partition"`
  234. Ntasks string `json:"ntasks"`
  235. Nodes string `json:"nodes"`
  236. BamFile string `json:"bamFile"`
  237. HashType string `json:"hashType"`
  238. AttackMode string `json:"attackMode"`
  239. HashInput string `json:"hashInput"`
  240. Mask string `json:"mask"`
  241. Dictionary string `json:"dictionary"`
  242. Dictionary2 string `json:"dictionary2"`
  243. HPCBindingFiles []HPCBindingFile `json:"hpcBindingFiles"`
  244. }
  245. type HPCBindingFile struct {
  246. ParamName string `json:"paramName"`
  247. Resource HPCFile `json:"resource"`
  248. }
  249. type HPCFile interface {
  250. Noop()
  251. }
  252. var HPCFileTypeUnion = types.NewTypeUnion[HPCFile](
  253. (*HPCObject)(nil),
  254. (*HPCPath)(nil),
  255. )
  256. var _ = serder.UseTypeUnionInternallyTagged(&HPCFileTypeUnion, "type")
  257. type HPCFileBase struct{}
  258. func (d *HPCFileBase) Noop() {}
  259. type HPCObject struct {
  260. serder.Metadata `union:"object"`
  261. HPCFileBase
  262. Type string `json:"type"`
  263. ObjectID cdssdk.ObjectID `json:"objectID"`
  264. }
  265. type HPCPath struct {
  266. serder.Metadata `union:"path"`
  267. HPCFileBase
  268. Type string `json:"type"`
  269. PackageID cdssdk.PackageID `json:"packageID"`
  270. Path string `json:"path"`
  271. }
  272. type JobResources struct {
  273. //任务分配策略:负载均衡、积分优先、随机分配等,dataLocality, leastLoadFirst
  274. ScheduleStrategy string `json:"scheduleStrategy"`
  275. Clusters []ClusterInfo `json:"clusters"`
  276. }
  277. type ClusterInfo struct {
  278. ClusterID ClusterID `json:"clusterID"`
  279. Resources []JobResource `json:"resources"`
  280. //Files JobFilesInfo `json:"files"`
  281. Code JobFileInfo `json:"code"`
  282. Runtime PCMJobRuntimeInfo `json:"runtime"`
  283. }
  284. type PCMJobRuntimeInfo struct {
  285. Command string `json:"command"`
  286. Envs map[string]interface{} `json:"envs"`
  287. Params map[string]interface{} `json:"params"`
  288. }
  289. //type Resource struct {
  290. // Resource []JobResource `json:"resource"`
  291. //}
  292. type JobResource interface {
  293. Noop()
  294. }
  295. var JobResourceTypeUnion = types.NewTypeUnion[JobResource](
  296. (*CPU)(nil),
  297. (*GPU)(nil),
  298. (*NPU)(nil),
  299. (*MLU)(nil),
  300. (*DCU)(nil),
  301. (*MEMORY)(nil),
  302. (*PRICE)(nil),
  303. (*STORAGE)(nil),
  304. )
  305. var _ = serder.UseTypeUnionInternallyTagged(&JobResourceTypeUnion, "type")
  306. type JobResourceBase struct{}
  307. func (d *JobResourceBase) Noop() {}
  308. type CPU struct {
  309. serder.Metadata `union:"CPU"`
  310. JobResourceBase
  311. Type string `json:"type"`
  312. Name string `json:"name"`
  313. Number int64 `json:"number"`
  314. }
  315. type STORAGE struct {
  316. serder.Metadata `union:"STORAGE"`
  317. JobResourceBase
  318. Type string `json:"type"`
  319. Name string `json:"name"`
  320. Number int64 `json:"number"`
  321. }
  322. type GPU struct {
  323. serder.Metadata `union:"GPU"`
  324. JobResourceBase
  325. Type string `json:"type"`
  326. Name string `json:"name"`
  327. Number int64 `json:"number"`
  328. }
  329. type NPU struct {
  330. serder.Metadata `union:"NPU"`
  331. JobResourceBase
  332. Type string `json:"type"`
  333. Name string `json:"name"`
  334. Number int64 `json:"number"`
  335. }
  336. type MEMORY struct {
  337. serder.Metadata `union:"MEMORY"`
  338. JobResourceBase
  339. Type string `json:"type"`
  340. Name string `json:"name"`
  341. Number int64 `json:"number"`
  342. }
  343. type DCU struct {
  344. serder.Metadata `union:"DCU"`
  345. JobResourceBase
  346. Type string `json:"type"`
  347. Name string `json:"name"`
  348. Number int64 `json:"number"`
  349. }
  350. type MLU struct {
  351. serder.Metadata `union:"MLU"`
  352. JobResourceBase
  353. Type string `json:"type"`
  354. Name string `json:"name"`
  355. Number int64 `json:"number"`
  356. }
  357. type PRICE struct {
  358. serder.Metadata `union:"PRICE"`
  359. JobResourceBase
  360. Type string `json:"type"`
  361. Name string `json:"name"`
  362. Number int64 `json:"number"`
  363. }
  364. // FinetuningJobInfo 模型微调
  365. type FinetuningJobInfo struct {
  366. serder.Metadata `union:"Finetuning"`
  367. JobInfoBase
  368. Type string `json:"type"`
  369. Files JobFilesInfo `json:"files"`
  370. Runtime JobRuntimeInfo `json:"runtime"`
  371. Resources JobResourcesInfo `json:"resources"`
  372. Services JobServicesInfo `json:"services"`
  373. ModelJobInfo ModelJobInfo `json:"modelJobInfo"`
  374. }
  375. // DataPreprocessJobInfo 数据预处理
  376. type DataPreprocessJobInfo struct {
  377. serder.Metadata `union:"DataPreprocess"`
  378. JobInfoBase
  379. Type string `json:"type"`
  380. Files JobFilesInfo `json:"files"`
  381. Runtime JobRuntimeInfo `json:"runtime"`
  382. Resources JobResourcesInfo `json:"resources"`
  383. Services JobServicesInfo `json:"services"`
  384. }
  385. type DataReturnJobInfo struct {
  386. serder.Metadata `union:"DataReturn"`
  387. JobInfoBase
  388. Type string `json:"type"`
  389. BucketID cdssdk.BucketID `json:"bucketID"`
  390. TargetLocalJobID string `json:"targetLocalJobID"`
  391. ReportMessage TrainJobStatusReport `json:"report"`
  392. }
  393. // MultiInstanceJobInfo 多实例(推理任务)
  394. type MultiInstanceJobInfo struct {
  395. serder.Metadata `union:"MultiInstance"`
  396. JobInfoBase
  397. Type string `json:"type"`
  398. Files JobFilesInfo `json:"files"`
  399. Runtime JobRuntimeInfo `json:"runtime"`
  400. Resources JobResourcesInfo `json:"resources"`
  401. ModelJobInfo ModelJobInfo `json:"modelJobInfo"`
  402. }
  403. // UpdateMultiInstanceJobInfo 更新模型
  404. type UpdateMultiInstanceJobInfo struct {
  405. serder.Metadata `union:"UpdateModel"`
  406. JobInfoBase
  407. Type string `json:"type"`
  408. Files JobFilesInfo `json:"files"`
  409. Runtime JobRuntimeInfo `json:"runtime"`
  410. MultiInstanceJobSetID JobSetID `json:"multiInstanceJobSetID"`
  411. UpdateType string `json:"updateType"`
  412. SubJobs []JobID `json:"subJobs"`
  413. Operate string `json:"operate"`
  414. }
  415. type ModelJobInfo struct {
  416. Type string `json:"type"`
  417. ModelID ModelID `json:"modelID"`
  418. CustomModelName ModelName `json:"customModelName"`
  419. Command string `json:"command"`
  420. }
  421. // InstanceJobInfo 单实例(推理任务)
  422. type InstanceJobInfo struct {
  423. serder.Metadata `union:"Instance"`
  424. JobInfoBase
  425. Type string `json:"type"`
  426. LocalJobID string `json:"multiInstJobID"`
  427. Files JobFilesInfo `json:"files"`
  428. Runtime JobRuntimeInfo `json:"runtime"`
  429. Resources JobResourcesInfo `json:"resources"`
  430. ModelJobInfo ModelJobInfo `json:"modelJobInfo"`
  431. }
  432. type JobFilesInfo struct {
  433. Dataset JobFileInfo `json:"dataset"`
  434. Code JobFileInfo `json:"code"`
  435. Image JobFileInfo `json:"image"`
  436. Model JobFileInfo `json:"model"`
  437. }
  438. type JobFileInfo interface {
  439. Noop()
  440. }
  441. var FileInfoTypeUnion = types.NewTypeUnion[JobFileInfo](
  442. (*PackageJobFileInfo)(nil),
  443. (*LocalJobFileInfo)(nil),
  444. (*DataReturnJobFileInfo)(nil),
  445. (*ImageJobFileInfo)(nil),
  446. (*BindingJobFileInfo)(nil),
  447. )
  448. var _ = serder.UseTypeUnionInternallyTagged(&FileInfoTypeUnion, "type")
  449. type JobFileInfoBase struct{}
  450. func (i *JobFileInfoBase) Noop() {}
  451. type BindingJobFileInfo struct {
  452. serder.Metadata `union:"Binding"`
  453. JobFileInfoBase
  454. Type string `json:"type"`
  455. BindingID int64 `json:"bindingID"`
  456. // 用于参数回显
  457. BindingName string `json:"bindingName"`
  458. }
  459. type PackageJobFileInfo struct {
  460. serder.Metadata `union:"Package"`
  461. JobFileInfoBase
  462. Type string `json:"type"`
  463. PackageID cdssdk.PackageID `json:"packageID"`
  464. }
  465. type LocalJobFileInfo struct {
  466. serder.Metadata `union:"LocalFile"`
  467. JobFileInfoBase
  468. Type string `json:"type"`
  469. LocalPath string `json:"localPath"`
  470. }
  471. type DataReturnJobFileInfo struct {
  472. serder.Metadata `union:"DataReturn"`
  473. JobFileInfoBase
  474. Type string `json:"type"`
  475. DataReturnLocalJobID string `json:"dataReturnLocalJobID"`
  476. }
  477. type ImageJobFileInfo struct {
  478. serder.Metadata `union:"Image"`
  479. JobFileInfoBase
  480. Type string `json:"type"`
  481. ImageID ImageID `json:"imageID"`
  482. // 用于参数回显
  483. ImageName string `json:"imageName"`
  484. }
  485. type JobRuntimeInfo struct {
  486. Command string `json:"command"`
  487. Envs []KVPair `json:"envs"`
  488. Params []KVPair `json:"params"`
  489. }
  490. type KVPair struct {
  491. Key string `json:"key"`
  492. Value string `json:"value"`
  493. }
  494. // CPU、GPU、NPU、MLU单位为:核
  495. // Storage、Memory单位为:字节
  496. type JobResourcesInfo struct {
  497. CPU float64 `json:"cpu"`
  498. GPU float64 `json:"gpu"`
  499. NPU float64 `json:"npu"`
  500. MLU float64 `json:"mlu"`
  501. Storage int64 `json:"storage"`
  502. Memory int64 `json:"memory"`
  503. }
  504. type JobSetFilesUploadScheme struct {
  505. LocalFileSchemes []LocalFileUploadScheme `json:"localFileUploadSchemes"`
  506. }
  507. type JobFilesUploadScheme struct {
  508. LocalFileSchemes []LocalFileUploadScheme `json:"localFileUploadSchemes"`
  509. }
  510. type LocalFileUploadScheme struct {
  511. LocalPath string `json:"localPath"`
  512. UploadToCDStorageID cdssdk.StorageID `json:"uploadToCDSStorageID"`
  513. }
  514. type JobServicesInfo struct {
  515. ServicePortInfos []ServicePortInfo `json:"servicePortInfos"`
  516. }
  517. type ServicePortInfo struct {
  518. Name string `json:"name"`
  519. Port int64 `json:"port"`
  520. }
  521. type JobSetServiceInfo struct {
  522. Name string `json:"name"`
  523. Port int64 `json:"port"`
  524. CDSStorageID cdssdk.StorageID `json:"cdsStorageID"`
  525. LocalJobID string `json:"localJobID"`
  526. }
  527. type Bootstrap interface {
  528. GetBootstrapType() string
  529. }
  530. type DirectBootstrap struct {
  531. serder.Metadata `union:"Direct"`
  532. Type string `json:"type"`
  533. }
  534. type NoEnvBootstrap struct {
  535. serder.Metadata `union:"NoEnv"`
  536. Type string `json:"type"`
  537. ScriptPackageID cdssdk.PackageID `json:"scriptPackageID"`
  538. ScriptFileName string `json:"scriptFileName"`
  539. }
  540. var BootstrapTypeUnion = types.NewTypeUnion[Bootstrap](
  541. (*DirectBootstrap)(nil),
  542. (*NoEnvBootstrap)(nil),
  543. )
  544. var _ = serder.UseTypeUnionInternallyTagged(&BootstrapTypeUnion, "type")
  545. func (b *DirectBootstrap) GetBootstrapType() string {
  546. return b.Type
  547. }
  548. func (b *NoEnvBootstrap) GetBootstrapType() string {
  549. return b.Type
  550. }
  551. const (
  552. JobDataInEnv = "SCH_DATA_IN"
  553. JobDataOutEnv = "SCH_DATA_OUT"
  554. FinetuningOutEnv = "FINETUNING_OUT"
  555. AccessPath = "ACCESS_PATH"
  556. )
  557. type Rclone struct {
  558. CDSRcloneID string `json:"cds_rcloneID"`
  559. CDSRcloneConfigID string `json:"cds_rcloneConfigID"`
  560. }
  561. type InferencePlatform struct {
  562. PlatformName string `json:"platformName"`
  563. ApiBaseUrl string `json:"apiBaseUrl"`
  564. ApiKey string `json:"apiKey"`
  565. ApiProxy string `json:"apiProxy"`
  566. LlmModel string `json:"llmModel"`
  567. EmbedModel string `json:"embedModel"`
  568. ChunkMaxLength string `json:"chunkMaxLength"`
  569. StartChunkThreshold string `json:"startChunkThreshold"`
  570. SimilarityThreshold string `json:"similarityThreshold"`
  571. EntriesPerFile string `json:"entriesPerFile"`
  572. }
  573. type JobOutput interface {
  574. Output2()
  575. }
  576. var JobOutputTypeUnion = types.NewTypeUnion[JobOutput](
  577. (*AIJobOutput)(nil),
  578. (*BindingJobOutput)(nil),
  579. (*UploadJobOutput)(nil),
  580. (*HPCJobOutput)(nil),
  581. (*NotifyJobOutput)(nil),
  582. )
  583. var _ = serder.UseTypeUnionInternallyTagged(&JobOutputTypeUnion, "type")
  584. type JobOutputBase struct{}
  585. func (d *JobOutputBase) Output2() {}
  586. type PublicOutput struct {
  587. serder.Metadata `union:"object"`
  588. JobOutputBase
  589. Type string `json:"type"`
  590. Output string `json:"output"`
  591. }
  592. type NotifyJobOutput struct {
  593. serder.Metadata `union:"Notify"`
  594. JobOutputBase
  595. Type string `json:"type"`
  596. Output string `json:"output"`
  597. }
  598. type HPCJobOutput struct {
  599. serder.Metadata `union:"HPCSlurm"`
  600. JobOutputBase
  601. Type string `json:"type"`
  602. Output string `json:"output"`
  603. }
  604. type AIJobOutput struct {
  605. serder.Metadata `union:"AI"`
  606. JobOutputBase
  607. Type string `json:"type"`
  608. Output string `json:"output"`
  609. }
  610. type BindingJobOutput struct {
  611. serder.Metadata `union:"binding"`
  612. JobOutputBase
  613. Type string `json:"type"`
  614. BindingID DataID `json:"bindingID"`
  615. }
  616. type UploadJobOutput struct {
  617. serder.Metadata `union:"upload"`
  618. JobOutputBase
  619. Type string `json:"type"`
  620. PackageID cdssdk.PackageID `json:"packageID"`
  621. }
  622. type DataReturnJobOutput struct {
  623. serder.Metadata `union:"DataReturn"`
  624. JobOutputBase
  625. Type string `json:"type"`
  626. ReportMessage TrainJobStatusReport `json:"report"`
  627. PackageID cdssdk.PackageID `json:"packageID"`
  628. }
  629. type JobStatusReport interface {
  630. Report()
  631. }
  632. var JobStatusReportTypeUnion = types.NewTypeUnion[JobStatusReport](
  633. (*TrainJobStatusReport)(nil),
  634. (*InferenceJobStatusReport)(nil),
  635. )
  636. var _ = serder.UseTypeUnionInternallyTagged(&JobStatusReportTypeUnion, "type")
  637. type JobStatusReportBase struct{}
  638. func (d *JobStatusReportBase) Report() {}
  639. type TrainJobStatusReport struct {
  640. serder.Metadata `union:"Train"`
  641. JobStatusReportBase
  642. Type string `json:"type"`
  643. TaskName string `json:"taskName"`
  644. TaskID string `json:"taskID"`
  645. Status bool `json:"status"`
  646. Message string `json:"message"`
  647. ClusterID ClusterID `json:"clusterID"`
  648. Output string `json:"output"`
  649. }
  650. type InferenceJobStatusReport struct {
  651. serder.Metadata `union:"Inference"`
  652. JobStatusReportBase
  653. Type string `json:"type"`
  654. TaskName string `json:"taskName"`
  655. TaskID string `json:"taskID"`
  656. Status bool `json:"status"`
  657. Message string `json:"message"`
  658. URL string `json:"url"`
  659. }