New BrontoAI arrived!
BrontoAI Turbocharges Your Generative AI Projects
BrontoAI provides enterprise solution architectures and coding frameworks tailored for Generative AI projects. Trusted by industry leaders like Johnson & Johnson and Duke Energy, we handle the coding groundwork for your application. With our support, you’ll launch your GenAI project faster than you ever imagined possible.
async def generate(messages: List[Message], model_type: str) -> AsyncGenerator[str, None]:
logger.info(f"Generating responses for the model type: {model_type}")
try:
client = AsyncOpenAI(api_key=settings.OPENAI_API_KEY)
logger.info(f"Requesting completions from OpenAI with {len(messages)} messages")
response = await client.chat.completions.create(
model=model_type,
messages=[message.dict() for message in messages],
stream=True
)
async for chunk in response:
if len(chunk.choices) > 0:
content = chunk.choices[0].delta.content
if content:
yield content
except Exception as e:
logger.error(f"An error occurred while generating responses: {e}")
return
Trusted by the best brands
All groundwork!
All you need to design GenAI applications tailored to your business needs.
Integrate with AWS Bedrock, Azure OpenAI, and GCP Vertex AI.
Craft amazing, professional-grade apps with foundation models swiftly using our powerful architecture and core code.