Below you will find pages that utilize the taxonomy term “ai”
mggg's Blog
Exploring Langchain Streaming LLM with OpenAI's Streaming Features
Streamlining AI Interactions with Langchain Streaming LLM and OpenAI Discover the transformative power of Langchain Streaming LLM combined with OpenAI’s streaming services. This synergy enhances real-time processing capabilities for language models, revolutionizing user experiences and expanding AI’s potential in data handling and responsive communication.
Advancing AI Communication with Langchain’s Streaming and Callback Mechanisms At the core of Langchain’s streaming prowess are its constructor callbacks, which ensure smooth integration with OpenAI’s API.
mggg's Blog
How to Build a Zero-Cost AI Application Using Cloudflare
How to Build a Zero-Cost AI Application: A Step-by-Step Guide Using Cloudflare Harness the power of Cloudflare’s free tier to construct AI applications without incurring costs. This guide delineates the process of employing JavaScript along with Cloudflare’s suite of services—including AI inference engines and Cloudflare Workers—to craft a robust, serverless AI application.
Step-by-Step Configuration for AI Deployment on Cloudflare Step 1: Initiate with Cloudflare Account Configuration Kickstart your journey by setting up your Cloudflare account.
mggg's 博客
使用Cloudflare构建0成本的AI应用
构建0成本的AI应用:利用Cloudflare的强大功能 在当前的技术环境中,利用Cloudflare的免费套餐(Free Plan)可以轻松构建零成本的AI应用。仅通过使用JavaScript和Cloudflare的几个关键服务——Cloudflare AI, Cloudflare Worker, 和 Cloudflare Page——来实现这一目标。其中,Cloudflare Worker充当后端服务,而Cloudflare Page则扮演前端的角色。
初步准备 要开始这个项目,首先需要:
注册并开通Cloudflare账户。 从域名dashboard页面获取必要的认证信息,包括Account ID , 和API Token Cloudflare AI Cloudflare AI目前免费支持多种模型
@cf/baai/bge-base-en-v1.5 @cf/baai/bge-large-en-v1.5 @cf/baai/bge-small-en-v1.5 @cf/huggingface/distilbert-sst-2-int8 @cf/meta/llama-2-7b-chat-fp16 @cf/meta/llama-2-7b-chat-int8 @cf/meta/m2m100-1.2b @cf/microsoft/resnet-50 @cf/mistral/mistral-7b-instruct-v0.1 @cf/openai/whisper @cf/stabilityai/stable-diffusion-xl-base-1.0 可以通过以下命令行示例,结合前面获取的ACCOUNT_ID和API_TOKEN,快速测试这些模型:
curl -X POST \ https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/ai/run/@cf/meta/llama-2-7b-chat-int8 \ -H "Authorization: Bearer {API_TOKEN}" \ -d '{"messages":[{"role":"system","content":"You are a friendly assistant that helps write stories"},{"role":"user","content":"Write a short story about a llama that goes on a journey to find an orange cloud"}]}' Cloudflare Worker: 处理CORS 由于在使用Cloudflare Page时可能会遇到跨源资源共享(CORS)问题,因此可以通过Cloudflare Worker构建服务来解决这个问题,而不是直接调用Cloudflare AI的API。以下是一个基本的Cloudflare Worker脚本,用于处理CORS和转发AI模型请求:
mggg's Blog
Harnessing the Power of OpenAI's Latest Innovations
Introduction: Embracing the Future with OpenAI’s Updates In the ever-evolving landscape of artificial intelligence, staying updated with the latest advancements is not just a matter of curiosity, but a necessity for those looking to leverage AI for their projects. On the 11th of June, 2023, OpenAI introduced a slew of new features, marking a significant update to their Python SDK, now at version 1.0.0. In this blog, we’ll dive into these updates and explore how they can revolutionize the way we interact with AI.
mggg's 博客
OpenAI 11.06更新
OpenAI 11.06更新 在这篇博客中,将讨论 OpenAI 11.06 的一些更新,更新主要有:
聊天内容支持图片, gpt-4-vision-preview 返回内容支持json模式 引入system_fingerprint, 支持可复现性 OpenAI 多模态模型 OpenAI 引入的最令人兴奋的新功能之一是多模态模型,它可以处理文本和图像的组合。这一能力为 AI 应用打开了一个新的维度,从增强的视觉数据分析到更互动的聊天机器人。
GPT-4 Vision: gpt-4-vision-preview 示例: 分析阿里巴巴股票的K线.
import openai openai.api_key = "your-api-key" response = openai.ChatCompletion.create( model="gpt-4-vision-preview", messages=[ { "role": "user", "content": [ {"type": "text", "text": "What information can you understand from the K-line of the image?"}, { "type": "image_url", "image_url": "https://mggg.cloud/img/ali.png", }, ], } ], max_tokens=300, ) print(response.choices[0].message.content) output:
The image appears to show a candlestick chart for a stock, specifically ticker 'BABA' which is Alibaba Group Holding Limited.
mggg's Blog
Vector Database: Weaviate
Vector Database: Weaviate Weaviate is an innovative vector database known for its efficiency in storing and retrieving data. Utilizing vectors, Weaviate indexes data objects based on their semantic properties, offering a unique approach to data handling. It supports a variety of modules, including text2vec and OpenAI embeddings, providing flexibility in data vectorization.
Getting Started with Weaviate Deploying Weaviate is straightforward with docker-compose. The OpenAI module transforms text into embeddings, enhancing semantic search capabilities.