This project demonstrates the implementation of the Chain of Dictionary technique in AI applications, showcasing two main examples: a story generator and a multilingual travel assistant.
The Chain of Dictionary method is a powerful technique in AI and natural language processing that organizes a series of linked dictionaries or JSON objects to guide AI through tasks or conversations. This project implements this technique to create two practical applications.
- AI-driven story generator
- Multilingual travel assistant
- Step-by-step processing with contextual continuity
- Image generation for each step and final output
To run this project, you need to install the required dependencies:
pip install openai pillow
Make sure to set up your OpenAI API key as an environment variable:
export OPENAI_API_KEY="your-api-key-here"
To use the applications, run the respective Python scripts:
-
For the story generator:
python story_generator.py
-
For the multilingual travel assistant:
python travel_assistant.py
The story generator creates a science fiction story in multiple steps:
- Generate a basic premise
- Develop the main character
- Create a plot outline
- Write the opening paragraph
The travel assistant provides information about a destination in multiple languages:
- Suggest a popular tourist destination
- Provide key information about the destination
- Translate the information to French
- Translate the information to Spanish
- Structured creativity
- Contextual continuity
- Flexibility and adaptability
- Greater control over AI responses
- Token limitations
- Maintaining coherence throughout steps
- Effective error handling
- Integration with more AI models
- Expansion to more complex tasks and languages
- Improvement in error handling and edge cases