Skip to Content
Développer des applications avec GPT-4 et ChatGPT, 2e édition
book

Développer des applications avec GPT-4 et ChatGPT, 2e édition

by Olivier Caelen, Marie-Alice Blete
March 2025
Intermediate to advanced
272 pages
8h 14m
French
O'Reilly Media, Inc.
Content preview from Développer des applications avec GPT-4 et ChatGPT, 2e édition

Chapitre 4. Stratégies avancées d'intégration du LLM avec OpenAI

Cet ouvrage a été traduit à l'aide de l'IA. Tes réactions et tes commentaires sont les bienvenus : translation-feedback@oreilly.com

Maintenant que tu connais les bases des LLMs et de l'API OpenAI, il est temps de faire passer tes compétences au niveau supérieur. Ce chapitre couvre des stratégies puissantes qui te permettront d'exploiter le véritable potentiel des modèles d'OpenAI. De l'ingénierie prompte et du réglage fin des modèles pour des tâches spécifiques à la mise en œuvre de la conception RAG sur tes données propriétaires, ce chapitre te donnera toutes les connaissances nécessaires pour aller plus loin dans l'utilisation des LLMs avec OpenAI. Nous aborderons également quelques stratégies pour surmonter les pièges spécifiques que tu rencontreras en travaillant sur l'intégration des LLMs dans tes projets.

Ingénierie prompte

Avant de plonger dans l'ingénierie des prompts, examinons brièvement la fonction completion du modèle de chat, car cette section l'utilisera abondamment. Pour rendre le code plus compact, nous définissons la fonction comme suit :

client = OpenAI()

def chat_completion(prompt, model="gpt-4", temperature=0, response_format=None):
    res = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": prompt}],
        temperature=temperature,
        response_format=response_format 
    )
    return res.choices[0].message.content

Cette fonction reçoit un prompt et affiche le résultat de l'achèvement ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Windows® 8.1 IN DEPTH

Windows® 8.1 IN DEPTH

Brian Knittel, Paul McFedries
Managing Disk Subsystems using IBM TotalStorage Productivity Center

Managing Disk Subsystems using IBM TotalStorage Productivity Center

Mary Lovelace, Jason Bamford, Dariusz Ferenc, Madhav Vaze
Moving Data Across the DB2 Family

Moving Data Across the DB2 Family

Paolo Bruni, Michael Ho, Marko Milek, Arne Nilsen, Jose Mari Michael Sanchez

Publisher Resources

ISBN: 9798341634480