Open uniAIDevs opened 3 months ago
d4678992ac
)[!TIP] I can email you next time I complete a pull request if you set up your email here!
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
gateway/internal/provider/huggingface/huggingface.go
✓ https://github.com/uniAIDevs/ai/commit/60911bdcddb9e8d725b85d2cf0f8421262fce932 Edit
Create gateway/internal/provider/huggingface/huggingface.go with contents:
• Create a new file `huggingface.go` in the `gateway/internal/provider/huggingface/` directory. This file will define the `HuggingFaceProvider` struct and implement the `Provider` interface from `provider.go`.
• Implement methods for the `Provider` interface, focusing on fine-tuning transformer models. This includes methods for listing available models, initiating fine-tuning jobs, and retrieving the results of fine-tuning.
• Import necessary packages for interacting with the HuggingFace API, handling HTTP requests, and processing JSON data.
gateway/internal/provider/huggingface/huggingface.go
✓ Edit
Check gateway/internal/provider/huggingface/huggingface.go with contents:
Ran GitHub Actions for 60911bdcddb9e8d725b85d2cf0f8421262fce932:
gateway/internal/api/v1/finetune.go
✓ https://github.com/uniAIDevs/ai/commit/82f55933d34ab4ae641421256a30790d745a3cfd Edit
Create gateway/internal/api/v1/finetune.go with contents:
• Create a new file `finetune.go` in the `gateway/internal/api/v1/` directory to handle API requests related to fine-tuning.
• Define endpoints for initiating fine-tuning jobs and checking their status. Use the `HuggingFaceProvider` to interact with the HuggingFace API.
• Implement handlers for the new endpoints, parsing request data, calling the appropriate methods on the `HuggingFaceProvider`, and formatting responses.
gateway/internal/api/v1/finetune.go
✓ Edit
Check gateway/internal/api/v1/finetune.go with contents:
Ran GitHub Actions for 82f55933d34ab4ae641421256a30790d745a3cfd:
gateway/internal/api/v1/v1.go
! No changes made Edit
Modify gateway/internal/api/v1/v1.go with contents:
• Register the new fine-tuning endpoints defined in `finetune.go` with the router in `v1.go`.
• Ensure that the endpoints are properly authenticated and validate request data before processing.
gateway/internal/api/v1/v1.go
✗ Edit
Check gateway/internal/api/v1/v1.go with contents:
playgrounds/apps/studio/app/(llm)/playground/hooks/useModelFetch.tsx
✓ https://github.com/uniAIDevs/ai/commit/3f04b91788cb909b639228a1376a27f2ebcfa2cf Edit
Modify playgrounds/apps/studio/app/(llm)/playground/hooks/useModelFetch.tsx with contents:
• Update the `useModelFetch` hook to include an option for selecting transformer models for fine-tuning. This may involve adding a new state to track whether the user is interested in fine-tuning and fetching additional data from the backend if necessary.
• Adjust the API call to include requests to the new fine-tuning endpoints as needed.
--- +++ @@ -14,11 +14,13 @@ const BASE_URL = process.env.NEXT_PUBLIC_GATEWAY_URL ?? "http://localhost:3000"; export function useModelFetch() { const [providers, setProviders] = useState([]); +const [isFineTuning, setIsFineTuning] = useState (false); useEffect(() => { + const fetchEndpoint = isFineTuning ? `${BASE_URL}/api/v1/finetune/models` : `${BASE_URL}/api/v1/models`; async function fetchModels() { try { - const response = await fetch(`${BASE_URL}/api/v1/models`); + const response = await fetch(fetchEndpoint); const { models } = await response.json(); const fetchedProviders: ModelType[] = Object.keys(models).map( (key) => ({
playgrounds/apps/studio/app/(llm)/playground/hooks/useModelFetch.tsx
✓ Edit
Check playgrounds/apps/studio/app/(llm)/playground/hooks/useModelFetch.tsx with contents:
Ran GitHub Actions for 3f04b91788cb909b639228a1376a27f2ebcfa2cf:
playgrounds/apps/studio/app/(llm)/playground/components/modelselector.tsx
✓ https://github.com/uniAIDevs/ai/commit/bd0d2375e35ba4f7425000471c68d136c3864e24 Edit
Modify playgrounds/apps/studio/app/(llm)/playground/components/modelselector.tsx with contents:
• Modify the `ModelSelector` component to allow users to select transformer models for fine-tuning. This includes UI changes to present fine-tuning options and possibly a new UI component for selecting or uploading datasets for fine-tuning.
• Ensure that the component interacts correctly with the updated `useModelFetch` hook to fetch and display the relevant options.
--- +++ @@ -26,12 +26,18 @@ export default function ModelSelector(props: ModelSelectorProps) { const [open, setOpen] = React.useState(false); - const { providers } = useModelFetch(); + const [isFineTuning, setIsFineTuning] = React.useState(false); + const { providers } = useModelFetch(isFineTuning); const { model, setModel, setProvider } = useStore(); + + const toggleFineTuning = () => setIsFineTuning(!isFineTuning); return (+
Your organization has reached the subscribed usage limit. You can upgrade your account by purchasing a subscription at Stripe payment link
Checklist
- [X] Create `gateway/internal/provider/huggingface/huggingface.go` ✓ https://github.com/uniAIDevs/ai/commit/60911bdcddb9e8d725b85d2cf0f8421262fce932 [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/gateway/internal/provider/huggingface/huggingface.go) - [X] Running GitHub Actions for `gateway/internal/provider/huggingface/huggingface.go` ✓ [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/gateway/internal/provider/huggingface/huggingface.go) - [X] Create `gateway/internal/api/v1/finetune.go` ✓ https://github.com/uniAIDevs/ai/commit/82f55933d34ab4ae641421256a30790d745a3cfd [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/gateway/internal/api/v1/finetune.go) - [X] Running GitHub Actions for `gateway/internal/api/v1/finetune.go` ✓ [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/gateway/internal/api/v1/finetune.go) - [X] Modify `gateway/internal/api/v1/v1.go` ! No changes made [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/gateway/internal/api/v1/v1.go) - [X] Running GitHub Actions for `gateway/internal/api/v1/v1.go` ✗ [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/gateway/internal/api/v1/v1.go) - [X] Modify `playgrounds/apps/studio/app/(llm)/playground/hooks/useModelFetch.tsx` ✓ https://github.com/uniAIDevs/ai/commit/3f04b91788cb909b639228a1376a27f2ebcfa2cf [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/playgrounds/apps/studio/app/(llm)/playground/hooks/useModelFetch.tsx) - [X] Running GitHub Actions for `playgrounds/apps/studio/app/(llm)/playground/hooks/useModelFetch.tsx` ✓ [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/playgrounds/apps/studio/app/(llm)/playground/hooks/useModelFetch.tsx) - [X] Modify `playgrounds/apps/studio/app/(llm)/playground/components/modelselector.tsx` ✓ https://github.com/uniAIDevs/ai/commit/bd0d2375e35ba4f7425000471c68d136c3864e24 [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/playgrounds/apps/studio/app/(llm)/playground/components/modelselector.tsx) - [X] Running GitHub Actions for `playgrounds/apps/studio/app/(llm)/playground/components/modelselector.tsx` ✓ [Edit](https://github.com/uniAIDevs/ai/edit/sweep/add_feature_for_llm_finetuning_from_hugg/playgrounds/apps/studio/app/(llm)/playground/components/modelselector.tsx)