import osimport openaiclient = openai.OpenAI( api_key=os.environ.get("TAAM_API_KEY"), base_url="https://api.gately.ai/v1")response = client.chat.completions.create( model="gpt-4-turbo", messages=[ {"role": "system", "content": "You are a travel agent. Be descriptive and helpful."}, {"role": "user", "content": "Tell me the top 3 things to do in San Francisco"} ])print(response.choices[0].message.content)
stream = client.chat.completions.create( model="gpt-4-turbo", messages=[ {"role": "system", content: "You are a travel agent."}, {"role": "user", content: "Tell me about San Francisco"} ], stream=True)for chunk in stream: print(chunk.choices[0].delta.content or "", end="", flush=True)
response = client.embeddings.create( model="text-embedding-3-small", input="Our solar system orbits the Milky Way galaxy at about 515,000 mph")print(response.data[0].embedding)