Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new OpenAI models #625

Merged
merged 3 commits into from
Feb 8, 2024
Merged

Add new OpenAI models #625

merged 3 commits into from
Feb 8, 2024

Conversation

EduardDurech
Copy link
Contributor

Added new OpenAI models gpt-3.5-turbo-0125, gpt-4-0125-preview, and gpt-4-turbo-preview (currently points to 0125-preview)

Copy link

welcome bot commented Feb 7, 2024

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@EduardDurech EduardDurech marked this pull request as ready for review February 7, 2024 10:18
@EduardDurech
Copy link
Contributor Author

image

@EduardDurech
Copy link
Contributor Author

It may be better to allow for manual entry of models

@EduardDurech
Copy link
Contributor Author

EduardDurech commented Feb 7, 2024

It may be better to allow for manual entry of models

This is what ChatGPT gives if anyone is interested in implementing it re https://github.com/jupyterlab/jupyter-ai/blob/main/packages/jupyter-ai/src/components/chat-settings.tsx

import React, { useEffect, useState, useMemo } from 'react';
import ReactMarkdown from 'react-markdown';
import { Box } from '@mui/system';
import {
  Alert,
  Autocomplete, // Ensure Autocomplete is imported
  Button,
  FormControl,
  FormControlLabel,
  FormLabel,
  MenuItem,
  Radio,
  RadioGroup,
  TextField,
  CircularProgress,
  Typography,
} from '@mui/material';

// Other imports remain unchanged

export function ChatSettings(): JSX.Element {
  // States and hooks initialization remains unchanged

  // Convert lmProviders for Autocomplete options
  const lmOptions = useMemo(() => {
    return server.lmProviders.providers.flatMap(lmp => 
      lmp.models.map(model => `${lmp.id}:${model}`)
    );
  }, [server.lmProviders]);

  return (
    <Box
      sx={{
        padding: '0 12px 12px',
        boxSizing: 'border-box',
        '& .MuiAlert-root': {
          marginTop: 2,
        },
        overflowY: 'auto',
      }}
    >
      <h2 className="jp-ai-ChatSettings-header">Language model</h2>
      {/* Autocomplete replacing Select */}
      <Autocomplete
        value={lmGlobalId}
        onChange={(event, newValue) => {
          const isValueExist = lmOptions.includes(newValue);
          if (isValueExist || newValue === null) {
            const [providerId, modelId] = newValue ? newValue.split(':') : [null, null];
            const nextLmProvider = getProvider(newValue, server.lmProviders);
            setLmProvider(nextLmProvider);
            setLmLocalId(modelId);
          } else {
            // Handle manually entered value not in the list
            setLmProvider(null);
            setLmLocalId(newValue);
          }
        }}
        options={lmOptions}
        renderInput={(params) => <TextField {...params} label="Language model" />}
        freeSolo
        inputValue={inputValue}
        onInputChange={(event, newInputValue) => {
          setInputValue(newInputValue);
        }}
      />
      {showLmLocalId && (
        <TextField
          label={lmProvider?.model_id_label || 'Local model ID'}
          value={lmLocalId}
          onChange={e => setLmLocalId(e.target.value)}
          fullWidth
        />
      )}
      {/* Remaining JSX unchanged */}
    </Box>
  );
}

@krassowski krassowski added the enhancement New feature or request label Feb 7, 2024
@krassowski krassowski changed the title Update providers.py Add new OpenAI models Feb 7, 2024
EduardDurech and others added 3 commits February 8, 2024 14:56
Added new OpenAI models gpt-3.5-turbo-0125, gpt-4-0125-preview, and gpt-4-turbo-preview (currently points to 0125-preview)
@JasonWeill JasonWeill enabled auto-merge (squash) February 8, 2024 22:57
@JasonWeill JasonWeill merged commit 40ff68c into jupyterlab:main Feb 8, 2024
8 checks passed
Copy link

welcome bot commented Feb 8, 2024

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

@JasonWeill
Copy link
Collaborator

@EduardDurech Thank you for adding these new models!

@JasonWeill
Copy link
Collaborator

@meeseeksdev please backport to 1.x

meeseeksmachine pushed a commit to meeseeksmachine/jupyter-ai that referenced this pull request Feb 8, 2024
JasonWeill pushed a commit that referenced this pull request Feb 8, 2024
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
* Update providers.py

Added new OpenAI models gpt-3.5-turbo-0125, gpt-4-0125-preview, and gpt-4-turbo-preview (currently points to 0125-preview)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update providers.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* Update providers.py

Added new OpenAI models gpt-3.5-turbo-0125, gpt-4-0125-preview, and gpt-4-turbo-preview (currently points to 0125-preview)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update providers.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants